-1

This is OOP file uploader from https://github.com/CreativeDream/php-uploader. I have an array output like this,

Array
(
    [files] => Array
        (
            [0] => news/idENPYygDf.png
        )

    [metas] => Array
        (
            [0] => Array
                (
                    [date] => Tue, 21 Feb 2017 03:55:27 +0100
                    [extension] => png
                    [file] => news/idENPYygDf.png
                    [name] => idENPYygDf.png // Can't get this Name
                    [old_name] => lobat.png
                    [replaced] => 
                    [size] => 313342
                    [size2] => 306.00 KB
                    [type] => Array
                        (
                            [0] => image
                            [1] => png
                        )

                )

        )

)

I'm trying to get the name but seems not working is this correct? I got an error says Notice: Undefined index: name

if($data['isComplete']){
     $files = $data['data']['metas']['name'];
     echo'<pre>';
     print_r($files);
     echo'</pre>';

}
BGTabulation BGTabulate
  • 1,677
  • 3
  • 16
  • 39

1 Answers1

1

The tag 'name' is inside a position in the 'metas' array, so I'd try with

$data['data']['metas'][0]['name'];

or with

$data['metas'][0]['name'];

Hope it helps!

virtginia
  • 11
  • 3