incridible
4 months ago

how to change default path of file storage

Posted 4 months ago by incridible

hi I wants to change default path of storing file from \storage\app\public\storage to \public\files,,, how to do this, any suggestion?

controller:

   public function store(Request $request)
   {
    request()->validate([
        'filename' => 'required',
    ]);

    $files = $request->file('filename');
    foreach ($files as $file) {
          File::create([
            'filename' => $file->getClientOriginalName(),
            'path' => $file->store('public/storage')
        ]);
     }
    
     return redirect('/file')->with('Success','File uploaded successfully');
  }

Please sign in or create an account to participate in this conversation.