Getting content of a local file without uploading [duplicate]

安稳与你 提交于 2019-12-05 09:22:43

The HTML5 File API might prove usefull

http://www.html5rocks.com/en/tutorials/file/dndfiles/

GAgnew
 input = document.getElementById(inputId);          

 var reader = new FileReader();

 reader.onload = function (e) {
     base64 = e.target.result;
 };

 reader.readAsDataURL(input.files[0]);

where input is an element <input type='file'></input>. Also works for an input that can select multiple files.

To work with files in the browser I use downloadify. In order to make it work with paths containing "file://" you need to allow for downloadify.swf access to the file system on the settings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!