lundi 30 mai 2016

Laravel validator only displaying message after reloading

I am trying to validate the image using validator

    $validator=Validator::make($request->all(),[
        'image'=>'image',
        ]);

if($validator->fails()){
    return redirect('/pop/add')
        ->withErrors($validator);   
         }

But when i add the file except the image it is displaying MethodNotFound Exception instead of the error message and when i reload the page it then displays the validation error message.

The view looks like:

    <form method="POST" action="" role="form" enctype="multipart/form-data">
{!! csrf_field() !!}
<label>Upload your photo:</label><input type="file" name="image" ><br>

and the route:

Route::get('/pop/addview','popcontroller@addview');
Route::post('/pop/add','popcontroller@addnow');



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/22uWpc8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire