CakePHP 3: Multiple file uploading returns string instead of array
<p>Hi I'm having a problem with multiple file uploading. Whenever I try to access the file properties it won't let me. I debugged my data and here's the output: 
Instead of returning me an array, it just returns me a string under data['files']. So I'm missing properties such as 'tmp_name', 'name', etc..</p>

<p><a href="https://i.stack.imgur.com/AVsHU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AVsHU.png" alt="enter image description here"></a></p>

<p>My code in my .ctp file :</p>

<pre><code>&lt;?= $this-&gt;Form-&gt;create('annonce') ?&gt;
&lt;fieldset&gt;
    &lt;legend&gt;&lt;?= __('Publier une annonce') ?&gt;&lt;/legend&gt;
    &lt;?php
        echo $this-&gt;Form-&gt;input('title', ['label' =&gt; 'Titre annonce']);
        echo $this-&gt;Form-&gt;input('description', ['label' =&gt; 'Description annonce', 'type' =&gt; 'textarea']);
        echo $this-&gt;Form-&gt;input('price', ['label' =&gt; 'Prix ', 'type' =&gt; 'number', 'placeholder' =&gt; '0$']);
        echo $this-&gt;Form-&gt;input('type_annonce', array(
        'options' =&gt; array('Acheter', 'Vendre', 'Échanger', 'Autre'),
        'empty' =&gt; 'Choisissez une option'), ['label' =&gt; 'Je souhaite']);
        echo $this-&gt;Form-&gt;input('category', array(
        'options' =&gt; array('Cheval', 'Poney', 'Matériel', 'Pension', 'Demi-pension'),
        'empty' =&gt; 'Choisissez une option'), ['label' =&gt; 'Je souhaite']);

        echo $this-&gt;Form-&gt;input('files.', array('type' =&gt; 'file', 'multiple' =&gt; 'true', 'enctype'=&gt;'multipart/form-data'));
    ?&gt;
&lt;/fieldset&gt;
&lt;?= $this-&gt;Form-&gt;button(__('Submit')) ?&gt;
&lt;?= $this-&gt;Form-&gt;end() ?&gt;
</code></pre>

<p>And my controller: </p>

<pre><code>    public function add()
{
    debug($this-&gt;request);
    $now = Time::now();
    $this-&gt;log('In add annonce !', 'debug');
    $annonce = $this-&gt;Annonces-&gt;newEntity();
    if ($this-&gt;request-&gt;is('post')) {
        if(!empty($this-&gt;request-&gt;data)) {
            $this-&gt;Flash-&gt;succes(__('Annonce files not empty'));
            foreach ($this-&gt;request-&gt;data['files'] as $file) {
                $filename = $file['name'];
                $file_tmp_name = $file['tmp_name'];
                $dir = WWW_ROOT.'img'.DS.'upload';
                $allowed = array('png', 'jpg', 'jpeg');

                echo "&lt;pre&gt;"; print_r($photo); echo "&lt;/pre&gt;";
                if ( !in_array( substr( strrchr( $filename , '.') , 1 ) , $allowed) ) {
                    throw new InternalErrorException("Error Processing Request.", 1);       
                }elseif( is_uploaded_file( $file_tmp_name ) ){
                    move_uploaded_file($file_tmp_name, $dir.DS.Text::uuid().'-'.$filename);
                }
            }
        }
        else {
            $this-&gt;Flash-&gt;error(__('Not in images'));
        }
        $annonce = $this-&gt;Annonces-&gt;patchEntity($annonce, $this-&gt;request-&gt;data);
        $annonce-&gt;id_user = $this-&gt;request-&gt;session()-&gt;read('Auth.User.id');
        $annonce-&gt;publication_date = $now;
        if ($this-&gt;Annonces-&gt;save($annonce)) {
            $this-&gt;log('Success saving annonce !', 'debug');
            $this-&gt;Flash-&gt;success(__('The annonce has been saved.'));
            return $this-&gt;redirect(['action' =&gt; 'index']);
        } else {
            $this-&gt;log($annonce-&gt;errors(), 'debug');
            $this-&gt;Flash-&gt;error(__('The annonce could not be saved. Please, try again.'));
        }
    }
    $this-&gt;set(compact('annonce'));
    $this-&gt;set('_serialize', ['annonce']);
}
</code></pre>