简体   繁体   中英

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

When I am uploading a file above 5mb I get the following error,

The "" file does not exist or is not readable.

This only happens once file sizes creep up towards 5mb, I cannot understand why this would be a problem, below is my code,

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');
}

If someone else gets this error and it doesn't turn out to be a permissions issue, check your php.ini...make sure that your upload_max_filesize is as big as your post_max_size. I had 1000M for post_max_size (we deal with some big ol' video files), but only 100M for upload_max_size (I blame my old eyes). The upload would churn for a long time, and then throw the error above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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