Elliot
Elliot

Reputation: 580

File upload destinationpath is not uploading

Problem is my Storage is not working. It's not uploading my file into destinationPath. When i dd my file path it not taking destination.

Controller@store

$destinationPath = config('app.filesDestinationPath').'/'.$bank.'/'.$username.'/'.$date.'/';        
foreach ($files as $file) {
   $filename = $file->getClientOriginalName();
   Storage::put($destinationPath.$filename.'.'.$file->getClientOriginalExtension(),file_get_contents($file->getRealPath()));
}

Controller@show

$directory = config('app.filesDestinationPath').'/'.$bank->$bank.'/'.$bank->username.'/'.$bank->date.'/';
$files = Storage::files($directory);
dd($files);
return view('banks.show', ['bank'=>$bank])->with(array('files' => $files));

Config/app

'fileDestinationPath' => 'uploads',
'allowedFileTypes' => 'jpg,jpeg,bmp,png',
'maxFileSize' => 1000000*2,

Config/filesystems

public' => [
 'driver' => 'local',
 'root' => storage_path('app/public'),
 'url' => env('APP_URL').'/storage',
 'visibility' => 'public',
],

Upvotes: 1

Views: 114

Answers (1)

Ruka Xing
Ruka Xing

Reputation: 642

App\Filesystems.php

'local' => [
    'driver' => 'local',
    'root' => resource_path('app');
],

Upvotes: 1

Related Questions