5

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');
}
1
  • 2
    try ini_set('upload_max_filesize', '500M') and ini_set('post_max_size', '500M') Commented Feb 21, 2020 at 8:52

1 Answer 1

5

If someone else gets this error and it doesn't turn out to be a permissions issue, check your php.ini file.

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.

Sign up to request clarification or add additional context in comments.

1 Comment

saved me hours here.... thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.