Is there a way in laravel to submit the uploaded file and the form data in a single ajax request while still having the form data accessible through the Laravel request interface?
For example, $request->file works fine, but $request->input('person.first') does not work because I am guessing Laravel is not parsing the data since it it mulitpart/form-data instead of application/json
let data = new FormData();
data.append('person', JSON.stringify(this.person));
data.append('file', this.resume);
$.ajax({
type: 'post',
url: '/application',
processData: false, // tell jQuery to not process the data
contentType: false, // tell jQuery to not set the content-type
data: data,
dataType: 'json'
})
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire