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'
})
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2DM1bhW
via IFTTT
Aucun commentaire:
Enregistrer un commentaire