jeudi 15 décembre 2016

form update with file upload laravel

I'm having a bit of an issue when it comes to updating a form and and having an file input. Here is what I am working with.

I have a form in laraval 5.1 which has a post method and a hidden 'Patch' method. This works as is should updating the fields that are in the form. However, when it introduce:

<input type="file" id="profile_picture" name="image_url" />

into the form, i get a:

MethodNotAllowedHttpException in RouteCollection.php line 218:

laravel error. I have tried changing the

 <input type='hidden' name='_method' value='PATCH'>

to PUT and it still doesnt like it.

My form looks like this:

<form action='' method="post" class="form-horizontal" enctype="multipart/form-data">

route resource looks like this:

Route::resource('profiles', 'ProfilesController');

I can't figure out what I am missing here...Any help is much appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire