views:

54

answers:

1

In Action Script, FileReference.browse() is called.

I would like to send the chosen file to Javascript and convert it to File object, just like if I would press the Browse button of the <input type='file /> and got File object.

I need that to be able to display picture thumbnail like shown here.

Maybe instead of passing the whole object it is possible to send only the required information for the thumbnail from the object ?

Thanks !

+1  A: 

I don't think there is any way to create a File object. For example, try this:

var f = new File;

I get an exception "Cannot convert WrappedNative to function." If you look in the docs for File, there is no constructor described. Also, most of the attributes are read-only. I would interpret this to mean that only the browser can create a File object.

Keep in mind that if you could create a File object by specifying the path to a file, it would be easy to upload files without the user's consent. That would be a serious security hole.

You may find it more practical to use only Flash or only HTML5 for this.

Mark Eirich
OK, Thank you very much for your response !
Misha Moroshko