开发者

Flash alternative for FileReader HTML 5 API

开发者 https://www.devze.com 2023-02-11 07:36 出处:网络
I want the conte开发者_JAVA技巧nt of a local text file to become available inside JavaScript. I\'ve achieved that using HTML 5 FileReader API, but this works only in Mozilla Firefox and Chrome now.

I want the conte开发者_JAVA技巧nt of a local text file to become available inside JavaScript. I've achieved that using HTML 5 FileReader API, but this works only in Mozilla Firefox and Chrome now.

I know that it is possible to create a cross-broswer solution using Flash. Is there any open-source project that do that?


Here's an open source project which provides you with the FileReader API in older browsers via flash:

https://github.com/Jahdrien/FileReader


Yes, it's possible. Use the FileReference.load method

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html#load%28%29

I don't know how it compares with the HTML5 API though. There are 2 requirements for the Flash version. It requires Flash Player 10 and you can't select a file automatically without opening a dialog box telling the user to select a file. Also, this dialog box can only pop up after a user interaction (click on a button, ...)

Example here :

http://actionsnippet.com/?p=1702

0

精彩评论

暂无评论...
验证码 换一张
取 消