FormData not working in IE

I need to upload an image to a ColdFusion server. I used FormData to make an AJAX request to transfer an image file. It works great for FF and chrome, but gives problems in IE and the form doesn't post. Is there an alternative way to do this? So it works great for FF, Chrome, IE8 +.

var formData = new FormData($(obj)[0]);
var actionPage = $(obj).attr('action');
if (validForm) {
    $('.mainPage').html('<div style="padding-top:20px;" align="center"><img alt="loading" src="/rpnet/images/ajax-loader.gif" /></div>');
    $.ajax({
        url: actionPage,
        type: 'POST',
        data: formData,
        async: false,
        cache: false,
        contentType: false,
        processData: false,
        success: function (returndata) {
          $('.mainPage').html(returndata);
        }
    });
}
return false;

      

This is the code I used to submit the form.

+3


source to share





All Articles