I didn't know it returned an array(I've never used it), however it may not have that key. Make sure you first check to make sure its an array and that that array key exists.

you should use this

PHP Code:
if(array_key_exists("path",$url))
{
//code here
}
if(
array_key_exists("url",$url))
{
//code here

PHP Code:
foreach($data as $name => $value)
{
echo 
$name ": " $value[0];

It will show
Code:
upload : o
potvrd: N
Add the above code to yours(above your foreach loop) and I guarantee it will output the first character of each value and not the full value that your seeking. The whole point of the foreach loop is to iterate through the array without having to use a regular for loop and the whole string counting bit. the $value variable is the data that the $name key holds, i.e if you added the below:

PHP Code:
$array[$name] = $value;
print_r($array); 
to your code in that foreach loop(either one) you'd make a duplicate array with the same key-value pairing as the original name $array.

the testing for if its an array in a foreach loop is not needed. You already hard coded it as an array so testing for it to be one is ridiculous, because you already know its an array. If anything you should have tested before hand if its an array because that function will be called every iteration and consume unneeded memory. Php allows for char level variable output and thats why what your doing in the foreach loop is wrong and poor coding in general. Don't take my word though, output that data during iteration and see for yourself the values it gives you.

As far as getting content types, well you'll need to probably use regex to get all the data after the .(because some formats use 4 characters for their extension instead of 3) or substr(). Compare that value to predefined values and return the appropriate content type.

Last edited by pein87; 15Jul2011 at 15:28..