tags:

views:

246

answers:

1

Is it possible to read a local file in a Flash? My application uploads files to server using the flash.net.FileReference class, and I would like to peek inside before I upload them. There are two indications as to why it could be possible:

  • I'm going to see the content of the files on the server anyway.

  • Silverlight can do that. The System.IO.FileInfo class provides a stream.

But so far, everything indicates otherwise. There seems to be nothing in the documentation, and a Google search has not revealed anything useful. I just want to make sure that it's not really possible before I move on. I'm aware that one can do it in AIR.

+1  A: 

Flash Player 10 supports this via a method and a property - FileReference.load() and FileReference.data. Once the user has selected the file they want with FileReference.browse() you can then call load(), listen for the Event.COMPLETE event, and then reference the data property to pull out the data you want.

Branden Hall
Thank you very much. This is exactly I was looking for. I’m running CS3 on my office computer, and thanks for Firefox awesome bar, I used to arrive to ActionScript 3 CS3 reference. It never occurred to me to switch to CS4 or even try to find something on Adobe website (which is impossible). This answer deserves more votes.
Jan Zich