Reply to accessing array data inside of an array

Your name:

Reply:


Posted by bill on 11/18/07 15:13

I want to extract the name of the photo uploaded.

print_r of $_FILES yields:
Files: Array ( [picture] => Array ( [name] =>
DSC_1802-saoirse-riona.jpg [type] => image/jpeg [tmp_name] =>
/tmp/phpJTspHZ [error] => 0 [size] => 76096 ) )

so we have an array with one element, picture, that contains an
array with an index, name, with a value of DSC_1802-saoirse-riona.jpg

I get the correct value when I:
$pic_name = $_FILES['picture']['name'];
echo $pic_name

however when I use:

echo "<br />pic_name = $_FILES[picture][name]";

I get:
pic_name = Array[name]

Why does the echo with the array reference not work while the
assignment does ?

bill

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация