Consider this block of code:
<form enctype=multipart/form-data action=... method=post>
...
<input type=file name=photo1 size=50>
<input type=file name=photo2 size=50>
<input type=file name=photo3 size=50>
<input type=file name=photo4 size=50>
<input type=file name=photo5 size=50>
...
</form>
In my PHP script, I have the following:
for ($i = 1; $i <= 5; $i++) {
if (is_uploaded_file($HTTP_POST_FILES['userfile'][$i]['tmp_name'])) {
$hasNoPics = false;
move_uploaded_file($HTTP_POST_FILES['userfile'][$i]['tmp_name'],
"$DOCUMENT_ROOT/webmissions/pics/$username/" .
$HTTP_POST_FILES['userfile'][$i]['name']
);
} else {
echo "Possible file upload attack. Filename: " .
$HTTP_POST_FILES['userfile'][$i]['name'];
$hasNoPics = true;
}
}
This block of code produces a riddling of PHP errors:
Warning: Undefined index: userfile in c:\program files\apache
group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 76
Warning: Undefined index: userfile in c:\program files\apache
group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 82
Possible file upload attack. Filename:
What I need to know is, what did I do wrong? I need to be able to move 1-5
submitted files at one time but I can't find any documentation on php.net
that handles such an exotic piece of code.
What do I do?
Phil
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php