views:

574

answers:

3

In Firefox 3 it is possible to access the contents of a <input type="file"> element as in the following.

Assume a form with the following element:

<input type="file" id="myinput">

Now the data of the file selected can be accessed with:

// Get the file's data as a data: URL
document.getElementById('myinput').files[0].getAsDataURL()

Is there a cross-browser way to accomplish the same thing?

Firefox documentation for this feature:

A: 

Why do you mean by getAsDataURL? You mean that data URI scheme? I doubt it.

Assaf Lavie
Yes that's right. Why shouldn't it be available? Wikipedia mentions it is supported in the major browsers I'd be interested in.
Doug
+4  A: 

No. Not yet. This is very FF specific. There is a working draft regarding local file access and Ajax file uploads, but it's just a draft.

I've done my research when writing a pure JavaScript file uploader.

Ionuț G. Stan
A: 

thanks this is what i was trying since a long time but i tried .click() instead of .getasdataurl

Nitesh