Page 1 of 1

Multiple File Upload not working, HELP!

Posted: Mon Oct 20, 2003 5:15 pm
by EverToDesign
Hey guys, heres the deal i have 2 pages. admin and admin2.php

Admin.php has a simple form (http://www.everto.net/sexvids/admin.php)

it has 9 upload boxes and comment boxes. Right now im working on the images, each upload box is named userfile[1], userfile[2], userfile[3] etc all the way up to userfile[9]. The form when submitted goes to admin2.php

Here it should loop until it uploads each file, instead the script seems to die and i get a blank screen.
Below is the PHP Source for admin2.php

Any ideas on whats wrong?

$archive_dir = "/images";
for ($counter=1; $counter<10; $counter++)
{
if(isset($WINDIR)) $userfile = str_replace("\\\\","\\", $userfile[$counter]);

$filename = basename($userfile[$counter]_name);

if($userfile_size[$counter] <= 0) die ("$filename is empty.");

if(!@copy($userfile[$counter], "$archive_dir/$filename"))
die("Can't copy $userfile_name to $filename.");

echo "$filename has been successfully uploaded to images/$filename.<BR>";
echo "Filesize: " . number_format($userfile_size) . "<BR>";
echo "Filetype: $userfile_type<BR>";
echo "A List of All Files is at dddd";

}
echo "all done";

Posted: Mon Oct 20, 2003 6:03 pm
by phice
Could you take off the '@' symbol before the 'copy' function, and see if that produces an error?

Also, you need the full path to the upload directory, not just "/images/folder/". You need something like "/usr/account/www/images/folder/"

Posted: Mon Oct 20, 2003 6:11 pm
by markl999
I'm not sure where you're getting $userfile from? When you upload the files you should get:
$_FILES['userfile'][1];
$_FILES['userfile'][2];
etc..etc..
Do a print_r($_FILES); to confirm this.

So wherever you have $userfile i would use $_FILES['userfile']

Also
$filename = basename($userfile[$counter]_name);
That can't be right. Maybe you want
$filename = basename($_FILES['userfile'][$counter]['name']);
?