I'm testing a file upload script, both locally and through a networked computer, but I get this error:
Notice: Undefined index: userfile in C:\Program Files\Apache Group\Apache2\htdocs\AdvEng\addstatus.php on line 37
and the same for lines 38-41
Here's the form:
<FORM enctype='multipart/form-data' method=post ACTION=addstatus.php NAME=addstatus>
<INPUT TYPE=hidden name=MAX_FILE_SIZE value='1000000'>
<INPUT TYPE=file NAME='userfile'>
<INPUT TYPE=hidden name=test value=true>
<INPUT TYPE=submit VALUE='Submit'></FORM>
Then the script:
function uploadfile() {
$tempreport = $_FILES["userfile"]['tmp_name'];
$userreport = $_FILES['userfile']['name'];
$reportsize = $_FILES['userfile']['size'];
$reporttype = $_FILES['userfile']['type'];
$uploaderror = $_FILES['userfile']['error'];
$newreportloc = '/status/'.$userreport;
if($uploaderror > 0) {
echo 'Problem: ';
switch ($uploaderror) {
case 1: echo 'File exceeded the maximum file upload size allowed.'; break;
case 2: echo 'File exceeded the maximum file size.'; break;
case 3: echo 'File was only partially loaded. Please try again.'; break;
case 4: echo 'No file was uploaded.'; break;
}
exit;
}
line 37-41 is the $tempreport = line and on
in phpinfo, file_upload is on, and there is an upload folder set. I'm using apache2 on win2k with php 4.3.1. register_globals is off
Uhm, I think that's it. There's more to the code, but it doesn't run without the $_FILES variables set.
😕 I've been banging my head against this for a while, I'm sure I'm just missing something stupid. Anyone know what it is? 😕
totally lost and confused