samedi 9 septembre 2017

Laravel 5.4 file upload issue (always throws validation error as file is null)

I'm following the normal file upload scenario

 {!! Form::open(array('route' => 'manufacturers.store','files' => true)) !!}
      <input type="text" name="name" placeholder="Manufacturer Name">
      <input type="file" name="image" id="Image" placeholder="Manufacturer Logo">
      <button type="submit" class="btn btn-primary pull-right">Add</button>
{!! Form::close() !!}

and in my controller i use validator

    Validator::make($request->all(), [
        'name' => 'required',
        'image' => 'required|mimes:jpeg,bmp,png',
    ])->validate();

which always fails as the file is null which i confirmed by

  dd($request->file('image'));

which gives null

i also checked upload_max_filesize and post_max_size which are having correct values. Are there any other configuration that disables file upload ?

(This used to work earlier) tried backtracking but couldn't find the error



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire