Page 1 of 1

File Upload Hell

Posted: Sat Mar 08, 2003 6:40 am
by mzfp2
i've read many posts on this forum previously posted, including topic 6435, tried everything, no matter what i do, $file is always null, and also $HTTP_POST_FILES is also always null:

the form:

<form name="form1" method="post" action="../db/upload.php?Action=upload" enctype="multipart/form-data">
<input type="file" name="file"><br>
<input type="submit" name="Submit" value="Submit">
</form>

the code

if ($file != "")
{
}
else
{
echo "no file";
}

it always returns no file

also tried debugging this way:

print_r($HTTP_POST_FILES);
print "<br>";

but prints nothing out as a result ...


ITS driving me crazt now, been trying without success for a week :(

Posted: Sat Mar 08, 2003 8:16 am
by pootergeist
try

foreach($_FILES['file'] as $varname=>$varval)
{
echo '$_FILES[''file'']['''.$varname.'''] = '.$varval.'<br />';
}

should give you an idea of which vars are available.

Posted: Sat Mar 08, 2003 1:16 pm
by phice
When using print_r, always use the following:

Code: Select all

<pre>
<?php
print_r(array);
?>
</pre>