Sanzeeb Aryal Sanzeeb Aryal - 1 year ago 94
PHP Question

Laravel validator only displaying message after reloading

I am trying to validate the image using validator


return redirect('/pop/add')

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="{{url('/pop/add')}}" role="form" enctype="multipart/form-data">
{!! csrf_field() !!}
<label>Upload your photo:</label><input type="file" name="image" ><br>

and the route:


Answer Source

You should redirect to '/pop/addview' instead of '/pop/add'.

return redirect('/pop/addview')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download