how read content from file in form input type=file

G

Garrett Smith

Conrad said:
For security reasons,


it's not possible to do that with JavaScript on
the client. You can read the file contents on the server after the form
has been submitted.

It's not possible, but not for security reasons. Arun took over
FIleUpload spec but doesn't seem to be working on it.

Gecko has FileList interface, but the problem is that it is not async.
An async read would be more ideal (because it avoids problems with
blocking).

Garrett
 
D

David Mark

it's not possible to do that with JavaScript on


It's not possible, but not for security reasons. Arun took over
FIleUpload spec but doesn't seem to be working on it.

Gecko has FileList interface, but the problem is that it is not async.
An async read would be more ideal (because it avoids problems with
blocking).

You can read local files with Ajax, providing your security settings
are configured to allow it. The operation is typically synchronous
because it is a local file. Blocking should not be an issue.
 
G

Garrett Smith

Conrad said:
Replying to myself (again):
Arun = Mozilla's Arun Ranganathan
FileList draft:
<http://dev.w3.org/2006/webapi/FileUpload/publish/FileUpload.xhtml>

Good detective work!

The problem with blocking is that there may be an issue with reading the
file. The server tipped over, or maybe the file gets locked up by
windows (I've never had *that* happen ;).

A synchronous FileList seems like a great interface until the problems
(which should be obvious) are recognized. An async approach is avoids
blocking problems that may occur with remote XHR.

The other neat thing in there is the file download, or "Save As" proposal.

Garrett
 
D

David Mark

Good detective work!

The problem with blocking is that there may be an issue with reading the
file. The server tipped over, or maybe the file gets locked up by
windows (I've never had *that* happen ;).

You've probably got bigger problems at that point. IIRC, IE converts
async XHR requests to synchronous for local (or cached) files. I've
always found it to be instantaneous, but a down file server could
certainly block the browser for a bit.

[snip]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top