2
 $extension = $file->getClientOriginalExtension();
 $directory = Storage::makeDirectory($this->objProperty->id); //create directory using property id.
 Storage::disk('local')->put($file->getFilename().'.'.$extension,  File::get($file));

Currently this code upload image into storage/upload/ directory but i want to upload this image into newly created directory($directory). Example: storage/upload/1/test.jpg

2
  • This needs some more context, but I suppose that disk('local') is a Flysystem "disk" which is configured to point to storage/upload/ Is that correct? Commented Apr 3, 2015 at 19:45
  • yes, in filesystem i have assign driver local to upload and its create upload directory and $directory = Storage::makeDirectory($this->objProperty->id); //create directory using property id. code also create directory as per id, but i can move image to that directory. Commented Apr 3, 2015 at 19:53

1 Answer 1

1

Specify folder in put() method:

Storage::disk('local')->put(
    $this->objProperty->id.'/'.$file->getFilename().'.'.$extension,
    File::get($file)
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.