У меня этот код работает
_private.saveFile=function(){
var formElement = $("#formId")[0];
var _params = new FormData(formElement),
_url = $(formElement).attr("action");
_private.postFile(_url,_params,function(data,error){
console.log(data);
console.log(error);
});
}
_private.postFile=function(_urlService,_parameters,callback){
var _url= _public.getPath()+_urlService;
_private.httpPostFile(_url,callback,_parameters);
};
_private.httpPostFile=function(_url,callback,_data){
$.ajax({
url: _url,
type: 'POST',
data: _data,
mimeType: "multipart/form-data",
contentType: false,
cache: false,
processData: false,
success: function (data, textStatus, jqXHR) {
callback(data,null);
},
error: function(xhr, status, error) {
console.log('error ',error);
console.log('status ',status);
console.log('xhr ',xhr);
callback(null,error);
}
});
}