Support the ongoing development of Laravel.io →
posted 5 years ago
Validation
Last updated 4 months ago.
0

You need the code below before everything else.

public function upload(Request $request) {

    $this->validate($request, [
            'picture' => 'required|mimeType:jpeg,jpg,png|max:10000',
    ]);

    // Continue with the upload process below....
}

What this code does it validate your request before moving on and doing anything else, then you can get the file after it is validated and continue with the upload process.

Last updated 5 years ago.
0

I have tryed, but same result. I will be redirected to the upload page, doesent matter, what i upload. Is it not the same (validation) like

$validator = \Illuminate\Support\Facades\Validator::make($request->all(), $rules);

but that i will not be redirected and can interpret the result from $validator?

Jan

Last updated 5 years ago.
0

Has no one an answer to this "basic" question? .

Jan

Last updated 5 years ago.
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

bforpc bforpc Joined 14 Dec 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.