How to create storage folder and sub folder using input names in laravel 5

- 1 answer

Ad

i am need advice to create folder upload in storage, i want to make folder using 4 column textbox

  • Division
  • activity
  • year
  • sponsor

how to make folder like this

storage/app/division/year/activity/sponsor/file.txt

and the code here

storage::disk('local')->put('logic');
Ad

Answer

Ad

Once you have sanitized and stored the input strings in the relative variables, to create the folder and upload the file you can do:

Storage::disk('local')
    ->put( $division .'/'. $activity . '/' . $year . '/' . $sponsor . '/file.txt',
           File::get( <your_file> )
);
Ad
source: stackoverflow.com
Ad