繁体   English   中英

laravel 文件上传 - "" 文件不存在或不可读

[英]laravel file upload - The "" file does not exist or is not readable

当我上传超过 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');
}

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM