Forum Moderators: coopster
echo"<pre>";
print_r($values);
echo"</pre>";
i get this structure:
Array
(
[imgTitle] => dss
[imgDesc] => dsssssssssss
[imgKeys] =>
[imgMeta] =>
[btnUpload] => Upload
[filename] => Array
(
[name] => fridg.jpg
[type] => image/jpeg
[tmp_name] => /tmp/php5YSexL
[error] => 0
[size] => 17583
)
)
what i need to get is all the top level values (and that is not a problem), but i have not been able to grab the filename without looping through the values like this:
foreach ($values as $key=>$value) {
if($key == 'filename'){echo"IMAGE::::$value[name]";}
}
which seems like a total waste of resources! I have tried lots of combos and i have not been able to directly access this value.
The most logical way that i can think of getting at this variable is: $values[filename][name]
but that gives me the following:
Array[name]
what am i missing?
It doesn't seem like you are missing anything. This should give you the desired result:
echo 'Filename: '.$values['filename']['name'];
If this doesn't work then your array must not be constructed as you think it is.
More on arrays here: [php.net...]