[英]FileNotFoundException in Filesystem.php line 41: File does not exist at path (LARAVEL)
I am trying to read the uploaded file to my system but I can't be able to read it because every time I do it I get this error FileNotFoundException in Filesystem.php line 41: File does not exist at path /var/www/html/..
I dont know what am I doing wrong in it. 我正在尝试将上传的文件读取到我的系统中,但是我无法读取它,因为每次我这样做时,都会
FileNotFoundException in Filesystem.php line 41: File does not exist at path /var/www/html/..
收到此错误FileNotFoundException in Filesystem.php line 41: File does not exist at path /var/www/html/..
我不知道我在做什么错。 I am using File::get()
method. 我正在使用
File::get()
方法。 Below is the code. 下面是代码。 Thanks for the help
谢谢您的帮助
public function getUploadedFile() {
$destinationPath = 'uploads';
$path= public_path()."/". $destinationPath;
echo $path; // this was to check whether am I getting the right path or not which I am getting.
$upload = new Upload;
$content = utf8_encode(File::get($path ."/". $upload->file_name));
return $content;
}
Model 模型
public function setFileAttribute($file){
$this->attributes['file'] = Carbon::now()->second.$file->getClientOriginalName();
$name = Carbon::now()->second.$file->getClientOriginalName();
\Storage::disk('local')->put($name, \File::get($file));
}
fileSystems.php fileSystems.php
'disks' => [
'local' => [
'driver' => 'local',
// 'root' => storage_path('public'),
'root' => public_path('storage'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('storage'),
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'your-region',
'bucket' => 'your-bucket',
],
],
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.