For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2004 > multi-file upload with a twist









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author multi-file upload with a twist
Dustin

2004-07-19, 3:57 pm


I'm looking for a PHP script that supports multi-file upload.
However, because my users could potentially be uploading hundreds of
files, the existing multi-file upload scripts that people have written
are not feasible. They involve selecting each file one at a time and
uploading.

Does anyone have a good solution for this or know if such a script
exists? I'd like a file browser that will allow several files to be
selected at once, of possibly allow the user to select a local
directory and have the script upload everything in that directory
(including subdirectories). Another option is a script that allows a
user to select multiple files, click upload, and have the script
actually zip up the files into one file before uploading the single
file. Not sure if such a thing exists.

If nothing like this is feasible, my only other option is to have the
user zip up the files and then just upload the one zip file. While
this will work, I'd really like to find an easier interface since the
majority of my users are not going to be very computer saavy.

Thanks,
Dustin
Marco

2004-07-19, 3:57 pm



--
"Dustin" <dustin_atm_99@no-spam.yahoo.com> ha scritto nel messaggio
news:ithnf0hqsvkcnsacakv2oeognpdaelld0s@
4ax.com...
>
> I'm looking for a PHP script that supports multi-file upload.
> However, because my users could potentially be uploading hundreds of
> files, the existing multi-file upload scripts that people have written
> are not feasible. They involve selecting each file one at a time and
> uploading.
>
> Does anyone have a good solution for this or know if such a script
> exists? I'd like a file browser that will allow several files to be
> selected at once, of possibly allow the user to select a local
> directory and have the script upload everything in that directory
> (including subdirectories). Another option is a script that allows a
> user to select multiple files, click upload, and have the script
> actually zip up the files into one file before uploading the single
> file. Not sure if such a thing exists.
>
> If nothing like this is feasible, my only other option is to have the
> user zip up the files and then just upload the one zip file. While
> this will work, I'd really like to find an easier interface since the
> majority of my users are not going to be very computer saavy.
>
> Thanks,
> Dustin


Neverming the fact I don't you $_POST arrays, it's old stuff, bet you can
fix it, anway it works, stripped some of the unnecessary code...

Will let you update max 10 files.

if (isset($userfile[0])) {

#Inizializzo le variabili

$length=sizeof($userfile);
$i=0;

while ($i < $length) {
$my_file = $userfile_name[$i];

#if ($userfile[$i] != "none") {
if ($userfile[$i] != "") {
if(!copy($userfile[$i], $my_file)) {
echo "File upload of $my_file failed!"; }
else {
//
}
}
$i++;
}

} else { ?>
<form action="<? print("$PHP_SELF"); ?>" method="post"
enctype="multipart/form-data">
Send these files:<br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input name="userfile[]" type="file"><br>
<input type="submit" value="Send files">
</form>
<? } ?>


--------------------------------------------------

www.tiipsi.com

M A R C O L A N D, Survival meets destiny

Fun, action and .... more.


Matthias Gutfeldt

2004-07-19, 3:57 pm

Dustin wrote:
> I'm looking for a PHP script that supports multi-file upload.
> However, because my users could potentially be uploading hundreds of
> files, the existing multi-file upload scripts that people have written
> are not feasible. They involve selecting each file one at a time and
> uploading.
>
> Does anyone have a good solution for this or know if such a script
> exists? I'd like a file browser that will allow several files to be
> selected at once, of possibly allow the user to select a local
> directory and have the script upload everything in that directory
> (including subdirectories).


The file upload menu doesn't allow to select multiple files. Your script
will have to provide as many input elements as the user wants to
upload files.

There seems to be a Java solution: <http://jupload.biz/>. Never tried it
though.


> have the script actually zip up the files into one file before
> uploading the single file. Not sure if such a thing exists.


The user has to zip the file; the server has (hopefully!) no access to
the user's computer.


Matthias

David Mackenzie

2004-07-19, 3:57 pm

On Mon, 19 Jul 2004 13:14:42 GMT, Dustin
<dustin_atm_99@no-spam.yahoo.com> wrote:

>
>I'm looking for a PHP script that supports multi-file upload.
>However, because my users could potentially be uploading hundreds of
>files, the existing multi-file upload scripts that people have written
>are not feasible. They involve selecting each file one at a time and
>uploading.
>
>Does anyone have a good solution for this or know if such a script
>exists? I'd like a file browser that will allow several files to be
>selected at once


By the specs, <input type=file> allows the user to select any number
of files for upload, although I think Opera is the only browser to
support this.

Having the user zip their files and then unzipping them server-side is
probably the best solution for non-Opera users. Added bonus is that
the user will have less data to transfer :-)

--
David ( @priz.co.uk )
Dustin

2004-07-21, 3:56 am


Thanks everyone for the responses.

-Dustin

On Mon, 19 Jul 2004 15:23:13 +0100, David Mackenzie <me@privacy.net>
wrote:

>On Mon, 19 Jul 2004 13:14:42 GMT, Dustin
><dustin_atm_99@no-spam.yahoo.com> wrote:
>
>
>By the specs, <input type=file> allows the user to select any number
>of files for upload, although I think Opera is the only browser to
>support this.
>
>Having the user zip their files and then unzipping them server-side is
>probably the best solution for non-Opera users. Added bonus is that
>the user will have less data to transfer :-)


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com