问题是我的存储无法正常工作。它没有将我的文件上传到destinationPath中。当我添加文件路径时,它没有目的地。
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));
配置/应用
'fileDestinationPath' => 'uploads',
'allowedFileTypes' => 'jpg,jpeg,bmp,png',
'maxFileSize' => 1000000*2,
配置/文件系统
public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
答案 0 :(得分:1)
App \ Filesystems.php
'local' => [
'driver' => 'local',
'root' => resource_path('app');
],