I need to upload a file to upload. This code works in chrome, opera and firefox, but not with IE:
$("input:file").change(function () { // Get a reference to the fileList var files = !!this.files ? this.files : []; // If no files were selected, or no FileReader support, return if ( !files.length || !window.FileReader ) return; // Only proceed if the selected file is an text if ( /^text/.test( files[0].type ) ) { var reader = new FileReader(); reader.readAsText( files[0] ); reader.onloadend = function() { restoreCSS(this.result); } } }
In IE !!this.files returns false. Thanks for the promotion.
source share