|
Posted by ZeldorBlat on 11/18/07 15:31
On Nov 18, 10:13 am, bill <nob...@spamcop.net> wrote:
> 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
Put quotes around your array keys:
$_FILES['picture']['name']
Navigation:
[Reply to this message]
|