[SOLVED]$_FILES question

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
User avatar
Jean-Yves
Forum Contributor
Posts: 148
Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK

[SOLVED]$_FILES question

Post 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
Last edited by Jean-Yves on Thu Mar 24, 2005 8:35 am, edited 1 time in total.
User avatar
Jean-Yves
Forum Contributor
Posts: 148
Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK

Post by Jean-Yves »

Forgot to say: PHP 4.3.10 on RHL
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

insteads of

Code: Select all

$_FILES['userfile']
use...

Code: Select all

$_FILES['fileShield']
User avatar
Jean-Yves
Forum Contributor
Posts: 148
Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK

Post 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
User avatar
Jean-Yves
Forum Contributor
Posts: 148
Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK

Post by Jean-Yves »

Oh, and thanks!
Post Reply