[英]Laravel 8 PHPUnit Failed Test -- Illuminate\Contracts\Filesystem\FileNotFoundException : File does not exist at path
[英]FileNotFoundException in Filesystem.php line 41: File does not exist at path (LARAVEL)
我正在尝试将上传的文件读取到我的系统中,但是我无法读取它,因为每次我这样做时,都会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/..
我不知道我在做什么错。 我正在使用File::get()
方法。 下面是代码。 谢谢您的帮助
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;
}
模型
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
'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.