Hey all. I'm trying to upload multiple files. I'm using the chm file from
php.net to help me figure it out. I also checked online and say theres a
problem with the file. Anyway My html looks like this:
<form enctype="multipart/form-data" action="file-upload.php" method="post">
Send these file:<br>
<input name="userfile[0]" type="file"><br>
<input name="userfile[1]" type="file"><br>
<input name="userfile[2]" type="file"><br>
<input type="submit" value="Send File">
</form>
<form enctype="multipart/form-data" action="file-upload.php" method="post\">
<input type="hidden" name="MAX_FILE_SIZE" value="1500000">
Send this file:<br>
<input name="userfile" type="file"><br>
<input type="submit" value="Send File">
</form>
My file-upload.php is:
<?php
$uploaddir = "files/";
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .
$_FILES['userfile']['name'])) {
print "File is valid, and was successfully uploaded. Here's some more
debugging info:\n";
print_r($_FILES);
}
else{
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}:
?>
This works for a single file and I've tried putting the <input type="hidden"
name="MAX_FILE_SIZE" value="1500000"> in the multiple file aswell and it
doesn't give me an error it just comes back with:
Possible file upload attack! Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => Array
(
[0] => 1_1024x768.jpg
[1] => 2_1024x768.jpg
[2] => 3_1024x768.jpg
)
[type] => Array
(
[0] => image/pjpeg
[1] => image/pjpeg
[2] => image/pjpeg
)
[tmp_name] => Array
(
[0] => C:\WINDOWS\TEMP\php1A5.tmp
[1] => C:\WINDOWS\TEMP\php1A6.tmp
[2] => C:\WINDOWS\TEMP\php1A7.tmp
)
[error] => Array
(
[0] => 0
[1] => 0
[2] => 0
)
[size] => Array
(
[0] => 461796
[1] => 576646
[2] => 640622
)
)
)
Can someone help me please. I don't know what I'm doing wrong and I can't
figure it out.Thanks in advance.