actually i found something in html5. its very quirky but...
PHP Code:
var reader = new FileReader();
function readText(){
reader.readAsText(document.getElementById("file1").files[0]);
document.getElementById('main').innerHTML=reader.result;
}
there's issues with the reader.result. here it works fine, but in other cases reader.result has returned null when called right after the readAsText function. so putting w/e instruction that calls reader.result into a setTimeout("instr", 10); would solve the issue.
Now i just wonder why it wont work in chrome. I've analyzed stuff and i can see chrome is fully compatible with the FileSystem object and the element.files[0]. I can't figure out why chrome always forget passing the value from readAsText into the reader.result value. reader.result just remains blank. urghh
function readText(that){ if(that.files && that.files[0]){ var reader = new FileReader(); reader.onload = function (e) { document.getElementById('main').innerHTML= e.target.result; };//end onload() reader.readAsText(that.files[0]); }//end if html5 filelist support }
it works just fine for me. you do know that it must be viewed from an http:// url don't you?
if your address bar url doesn't begin with http, but rather with file, it won't work.
when i published the text in your linked file to the web, the demo runs just fine in chrome 15.
Bookmarks