php - Create directory and upload image in Laravel 5 -
php - Create directory and upload image in Laravel 5 -
$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 code upload image storage/upload/ directory want upload image newly created directory($directory
). example: storage/upload/1/test.jpg
specify folder in put()
method:
storage::disk('local')->put( $this->objproperty->id.'/'.$file->getfilename().'.'.$extension, file::get($file) );
php laravel laravel-5
Comments
Post a Comment