Support the ongoing development of Laravel.io →
posted 7 years ago
Validation
Last updated 2 years 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 7 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 7 years ago.
0

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

Jan

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

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?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.