Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Allowing Client to Upload Multiple Files

3 views
Skip to first unread message

Peter Lauren

unread,
May 3, 2011, 3:22:16 PM5/3/11
to
I am building a web site and my server PCs are running Windows XP. I
would like the client to be able to upload multiple files. I have
considered the following.

1/ The following code from http://www.w3schools.com/TAGS/tag_select.asp.

<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

The user would only be able to use one file at a time.

2/ A modification of 1 where the user uploads a zip file, containing
all the files to upload. The approach then would be to unzip the
files server-side. One approach suggest for this was PHP Zip
http://www.w3schools.com/php/php_ref_zip.asp . This link says to
download and install zziplib. I have never had any luck with zlib but
I thought I would try this. Bunch of error messages. Had to change
the .c suffices to .cpp and also find and download a bunch of .h
files. Even then I got a bunch of error messages when I tried to
compile.

3/ Unzipping the uploaded zip file server-side using pkzip.exe.
Should that work?

4/ Using ftp. Should that work? How would I implement it?

5/ Using Flash or Starlight. Are these free? Can they be used server-
side?

Many thanks in advance for any feedback,
Peter.

Jukka K. Korpela

unread,
May 5, 2011, 2:43:38 AM5/5/11
to
"Peter Lauren" wrote:

> I would like the client to be able to upload multiple files.

The most convenient way from the user perspective is the attribute multiple
in the file input field: <input type=file name=foo id=files multiple>. On
supporting browsers, the user can select any number of files when using the
file selection widget.

As many browsers still don't support this nice feature, you might include,
say, ten <input type=file> fields, assuming ten is a reasonable maximum. And
you could use the multiple attribute in the first of those fields and use
JavaScript to hide the other fields if the multiple attribute is supported -
you can test this using the expression
document.getElementById("files").multiple as condition.

--
Yucca

Peter Lauren

unread,
May 5, 2011, 7:23:48 PM5/5/11
to

Hi Jukka,

Thank you so much for your reply. My problem is that the number of
<input type=file> fields is variable and typically on the order of
40-60. A reasonable maximum would be 70 to 80. I am leaning towards
using a for loop which would probably involve a mixture of html and
JavaScript on the client side. Of course the former solution, which I
understand will be available in html5, would be ideal. Maybe I could
have an if statement to see whether it is available on the client
browser. Do you know the syntax for checking for that?

Thanks again,
Peter.

Jukka K. Korpela

unread,
May 5, 2011, 11:35:04 PM5/5/11
to
6.5.2011 2:23, Peter Lauren wrote:

> Of course the former solution, which I
> understand will be available in html5, would be ideal. Maybe I could
> have an if statement to see whether it is available on the client
> browser. Do you know the syntax for checking for that?

It was in my message, in the part you quoted (you quoted it all).

I'm not interested in participating more in a multiposted discussion.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

0 new messages