views:

38

answers:

3

Is it possible to read the contents of an uploaded file (through <form><input type="file">) from inside javascript with no backend? I suppose it's possible with HTML5, but what about HTML4?

A: 

The security model will not let you unless you change the security to allow this. http://www.mozilla.org/projects/security/components/signed-scripts.html Can you elaborate on what you want to do?

I read the question as "How do I grab the contents from a file chosen using a file upload field and process it on the client without involving a backend/webserver". I am thinking UniversalBrowserRead access for FF and HTA filesystem for IE for example

mplungjan
+1  A: 

You can read (not upload - well, you can upload too, but that's like sending fan-mail to Edgar Allen Poe; nothing stops you but he won't be able to read it) from files if your script runs in a very trusted context.

If anyone on your network is browsing the web in a browser set to give that much trust, disconnect their machine from the network first, make their settings tighter second.

Jon Hanna
+1 for the joke and the sane advice.
janmoesen
A: 

I don't know if I understand correctly. How about using something like uploadify together with jQuery. I guess you'll have to grant the webserver the privilege to write in the specified folders.

dotmartin
What webserver?
mplungjan
Yeah. You are probably right mplungjan, nothing is mentioned about webservers. I might be way out of line, depending on what is meant by "without backend".
dotmartin
Added my comment to my answer
mplungjan