I'm really hoping someone can help!
I have looked through every possible answer on Stack Overflow to this. I create the form data
var formData = new FormData();
var uploadedFile = hiddenFileElement[0].files[0]
var inputValues = form.serializeArray();
$.each(inputValues, function(key, input) {
formData.append(input.name, input.value);
});
// add file
formData.append('file', uploadedFile);
I then prepare an ajax request and send the post data to a example.php file.
/**
* http://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax
*/
$.ajax({
url: url,
data: formData,
processData: false,
contentType: false,
type: 'POST'
}).done(function (response) {
....
When I receive this server side, I var dump $_FILE and $_POST are empty. I know the inputs exist when it builds the form data object. I even used the FormDataUnsafe example in another thread to confirm those values are there when posting. My header looks like this:
My content type is UTF-8 plain-text.
Content-Type:text/plain;charset=UTF-8
Shouldn't JQuery be changing this?
Also are their any server related configuration I should be thinking about?
Help would be appreciated, thanks.