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:

class="lang-php prettyprint-override">storage::disk('local')->put( $this->objproperty->id.'/'.$file->getfilename().'.'.$extension, file::get($file) );

php laravel laravel-5

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -