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');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire