vendredi 7 avril 2017

Update with files won't submit laravel

I'm working on a laravel project where I need file upload. I have successfully managed to get file upload for the create function working, but for the edit() and update() functions, it won't. The main problem is that the form won't submit. here is the import pits of my form:

<form action="" class="form-horizontal" method="post" enctype="multipart/form-data">
    <input type="hidden" name="_method" value="PATCH">
    <input type="hidden" name="_token" value=""><div class="form-group">
        <label for="imageUpload" class="control-label col-md-4">@lang('image upload')</label>
        <div class="col-md-6">
            <input type="file" name="images[]" class="form-control" multiple="multiple">
        </div>
    </div><input type="submit" value="أضف التعديل" class="btn btn-success btn-block btn-default">
</form>

Whenever I delete this section of code, the form submits and the update() works flawlessly

<div class="form-group">
    <label for="imageUpload" class="control-label col-md-4">@lang('image upload')</label>
    <div class="col-md-6">
        <input type="file" name="images[]" class="form-control" multiple="multiple">
    </div>

Things I've tried:

  • Changing the enctype to put
  • Changing the method from PATCH to PUT

Thanks in advance for your help




Aucun commentaire:

Enregistrer un commentaire