File Upload Hell

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

File Upload Hell

Post 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 :(
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post 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.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

When using print_r, always use the following:

Code: Select all

<pre>
<?php
print_r(array);
?>
</pre>
Image Image
Post Reply