I have a working form which uses FormData. I have now realised that this does not work in IE8 or IE9. Therefore, I am trying to create an alternative submit for these browsers. So in my submitHandler, I have the following
submitHandler: function (form) {
if(typeof window.FormData === 'undefined' ){
ie_ajax_upload();
}
else {
//normal form submit
}
}
So if the browser does not support FormData I call the function ie_ajax_upload. At the moment, this function looks like the following
function ie_ajax_upload(){
var iframe = $('<iframe name="postiframe" id="postiframe" style="display: none"></iframe>');
$("body").append(iframe);
var form = $('#my-form');
form.attr("action", "php/process.php");
form.attr("method", "post");
form.attr("encoding", "multipart/form-data");
form.attr("enctype", "multipart/form-data");
form.attr("target", "postiframe");
form.attr("file", $('#fileOne').val());
form.submit();
return false;
}
fileOne is the id of my file field in my form. At the moment, with the above, the function is successfully called. However, IE8 is giving the error
Unable to get property '0' of undefined or null reference
In relation to form.submit();
Why would this be occurring?
Thanks