I\'m seeming to have an issue with FormData being null. I\'m trying to upload files and JSON in a single POST request. I\'ve tried a variety of things, but nothing has seemed to
Okay I have same problem and I think know the solution after I read this documentation from MDN.
I fix it with this way:
var formData = new FormData();
// After instantiate the object we should use append method
// And append more data as you needed with this way:
formData.append('prices', $("#columnPrices").val());
formData.append('id', $("#columnIds").val());
formData.append('file', $("#uploadCSVWithData");
$(this).html('');
$.ajax({
type: "POST",
url: '{removed}',
data: formData,
success: function(done) {
$("#submitCSVForUpload").html("Submit");
$("#uploadFromCSVModal").modal('hide');
},
processData: false,
contentType: false
});
I hope it can help you :D