Page 1 of 1

[SOLVED]$_FILES question

Posted: Thu Mar 24, 2005 8:27 am
by Jean-Yves
Hi there,

I have a svery simple file upload script that is failing because for some reason I cannot access the values in $_FILES.

I have stuck in some debug code and what is odd is that using print_r extracts the correct values, wheres trying to access each array item individually fails:

Code: Select all

print "<pre>\n";
print_r($_FILES);
print "</pre>\n";
  
echo "<pre>\n";
echo "Name: " . $_FILES['userfile']['name'] . "\n";
echo "Type: " . $_FILES['userfile']['type'] . "\n";
echo "Size: " . $_FILES['userfile']['size'] . "\n";
echo "</pre>\n";
With a sample file, s_utarg.png, I get the following
Array
(
[fileShield] => Array
(
[name] => s_utarg.png
[type] => image/png
[tmp_name] => /tmp/phpXBkBEr
[error] => 0
[size] => 1117
)

)

Name:
Type:
Size:
Anything obvious wrong in the way I am addressing the individual array item values?

Thanks

Posted: Thu Mar 24, 2005 8:28 am
by Jean-Yves
Forgot to say: PHP 4.3.10 on RHL

Posted: Thu Mar 24, 2005 8:32 am
by JayBird
insteads of

Code: Select all

$_FILES['userfile']
use...

Code: Select all

$_FILES['fileShield']

Posted: Thu Mar 24, 2005 8:35 am
by Jean-Yves
Oooooooooooooooooooooooooh! What a plank I've been! Sorry about that.

In my defence, I'm just recovering from 5 days fever! Honest. I really am, you know!!!

:D :P :D

Posted: Thu Mar 24, 2005 8:41 am
by Jean-Yves
Oh, and thanks!