【问题标题】:laravel file upload - The "" file does not exist or is not readablelaravel 文件上传 - “”文件不存在或不可读
【发布时间】:2020-06-05 16:00:47
【问题描述】:

当我上传超过 5mb 的文件时,我收到以下错误,

“”文件不存在或不可读。

这只会在文件大小接近 5mb 时发生,我不明白为什么会出现问题,下面是我的代码,

public function verifySave(Request $request)
{
    $path = Storage::disk('local')->put('verification', $request->file('certificate'));
    //$path = $request->file('certificate')->putFileAs('verification');
    $newPath = \Storage::disk('local')->path($path);
    if(strpos($request->file('certificate')->getMimeType(), "image") !== false) {
        $pdf = new Fpdf();
        $pdf->AddPage();
        $pdf->Image($newPath, 0, 0, -300);
        $newPath = \Storage::disk('local')->path('verification/' . $request->file('certificate')->hashName() . '.pdf');
        $pdf->Output('F', $newPath);
    }

    $verification = [
        'death_certificate' => $newPath,
        'uploaded' => 'Yes',
        'method' => $request->input('verify_method')
    ];
    $request->session()->put('verification', $verification);
    return redirect('/your-details');
}

【问题讨论】:

  • 试试ini_set('upload_max_filesize', '500M')ini_set('post_max_size', '500M')

标签: php laravel file-upload


【解决方案1】:

如果其他人收到此错误并且结果不是权限问题,请检查您的 php.ini...确保您的 upload_max_filesize 与您的 post_max_size 一样大。我有 1000M 用于 post_max_size (我们处理一些大的视频文件),但只有 100M 用于 upload_max_size (我怪我的老眼睛)。上传会搅动很长时间,然后抛出上面的错误。

【讨论】:

  • 是的,兄弟,非常感谢。这有帮助:D
猜你喜欢
  • 1970-01-01
  • 2014-04-18
  • 1970-01-01
  • 2020-03-18
  • 2020-02-13
  • 2018-06-27
  • 1970-01-01
  • 2014-11-19
  • 1970-01-01
相关资源
最近更新 更多