Re: Form-based Multiple File Upload in HTML

Cybbie <cybbie@excite.com> wondered:

> Can the latest HTML handle multiple file attachments using one
> input command (e.g. by choosing browse on a HTML page, is there
> a way for a user to to hold SHIFT and CTRL to select multiple
> files and/or directory that would contain multiple files)?

Yes, that's exactly how it's supposed to work. Opera is the
only browser I know of that supports it. True multiple-file
upload needs support at the server end too; be sure your
scripting environment supports it, or be prepared to writing
some MIME-parsing code.

> Currently, I have developed multiple file attachments (max
> of 5 files) by creating five individual inputs using HTML

If you can be sure there'll never be more than 5 files this is
indeed one cross-browser solution. Other possibilities are:

a. Detect when a file has been input and add new file upload
fields using JavaScript and DOM methods. Drawback is that
the DOM Core is almost as badly-supported as multiple
file upload, so you don't gain much.

b. Again, detect when a file is input and use JavaScript to
alter the 'display' style of divs containing lots of predefined
file input fields so that new ones appear when the old ones
are filled. This still limits the number of files you can
upload, but means the user isn't immediately confronted
with two dozen empty file upload boxes.

c. Make it a multi-stage form, so that you can upload one
file and then ask to upload another repeatedly until
finished. You then have to start remembering state so it
can get quite tricky at the server end.

> I haven't seen any of the multiple file attachments using
> one input command line anywhere on the Web.

Indeed. Browser support is weak, and many form-reading
scripts don't work properly when multiple files are uploaded.
It doesn't look as though support is going to get much better
in the near future, either.

> Your assistance would greatly be appreciated. Any good 
> Web-page examples of this function on the Internet
> would be really nice also! 

I've got one, but it's behind a login screen so if you
really want to see it send me a mail. It's not wonderfully
exciting. It's just a standard file upload field; unless
you've got Opera 4 handy, you won't be able to use it
for multiple files.

-- 
Andrew Clover
Technical Support
1VALUE.com AG

Received on Friday, 21 July 2000 05:58:18 UTC