javascript - FormData file, ajax doesn't post $_FILES in IE 11 -
i have following code (formdata) in javascript , it's working in mozilla , chrome. when tried in ie 11, doesn't post using ajax. success function called, $_files
empty on server side.
file = _files[i][j]; if(j<_files[i].length){ if(file){ var data = new formdata(); data.append("uploadedimages", file); console.log("formdata:"+data); progresselement = $('#divimg_'+i+'_'+j); progresselement.css('visibility','visible').hide().fadein('500'); $.ajax({ url: "<?php echo base_url();?>"+"upload/do_upload", data: data, cache: false, contenttype: false, processdata: false, type: 'post', success: function(data){ console.log(data); j++; if(j<_files[i].length){ uploadmore(i,j); }else{ i++; uploadme(i,0); } }, xhr: function() { var xhr = new window.xmlhttprequest(); xhr.upload.addeventlistener( 'progress', function( e ) { if( e.lengthcomputable ) { // append progress percentage. var progressvalue = ( e.loaded / e.total ) * 100; console.log( + ':' + progressvalue ); progresselement.find( 'input' ).val( progressvalue ).change(); // listen clicks on cancel icon. $('#stopupload').click( function() { if( progresselement.hasclass( 'working' ) ) { xhr.abort(); progresselement.fadeout(500); } }); if( progressvalue == 100 ) { progresselement.removeclass( 'working' ); } } }, false); return xhr; } }); } else{ console.log("file error!"); j++; uploadmore(i,j); } }
Comments
Post a Comment