简体   繁体   English

Filesystem.php第41行中的FileNotFoundException:文件在路径(LARAVEL)中不存在

[英]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.

相关问题 Laravel 8 PHPUnit 测试失败——Illuminate\\Contracts\\Filesystem\\FileNotFoundException:文件在路径中不存在 - Laravel 8 PHPUnit Failed Test -- Illuminate\Contracts\Filesystem\FileNotFoundException : File does not exist at path vscode php 调试器 Illuminate\\Contracts\\Filesystem\\FileNotFoundException: 文件在路径中不存在 - Vscode php debugger Illuminate\Contracts\Filesystem\FileNotFoundException: File does not exist at path File.php 第 41 行中的 FileNotFoundException - FileNotFoundException in File.php line 41 Filesystem.php 中的 ErrorException - ErrorException in Filesystem.php "Filesystem.php 第 111 行中的 ErrorException:file_put_contents():未能打开流:没有这样的文件或目录" - ErrorException in Filesystem.php line 111:file_put_contents(): failed to open stream: No such file or directory Filesystem.php 中的 ErrorException - 权限被拒绝 - ErrorException in Filesystem.php - Permission denied Laravel文件在路径中找不到但它确实存在 - Laravel File not found at path but it does exist 文件“{$path}”不存在错误 laravel - File `{$path}` does not exist error In laravel 文件存在但 laravel 找不到它 (FileNotFoundException) - File exist but laravel can't find it (FileNotFoundException) FileNotFoundException; 文件不存在Laravel 5 Storage Upload,仅在服务器端发布 - FileNotFoundException; file does not exist Laravel 5 Storage Upload, issue only on server side
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM