We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Upload Files

I want to upload file from input with action form but all the times the function hasFiles return 0 and getUploadedFiles return empty Array !!!! form.volt

<form action="/upload/bu0msoNiYf63pXBPLImrcoBNGuJ7yLnVPpwKgwf1t1sHzlZsllsh01MsllsM1sllsXOsllsj3Yrslls/15504" method="post" enctype="multipart/form-data">
  <div class="col-md-3">
    - Label Upload 
  </div>
  <div class="col-md-4">
    <span id="uploadfile-RB-15504" class="label col-md-4"></span>
  </div>
   <div class="col-md-4">
    <div class="row">
      <label for="RB-15504" class="btn btn-primary col-xs-6">
        <input id="RB-15504" type="file" multiple="multiple" style="display:none" onchange="this.form.submit()">
        choisir un fichier
      </label>
    </div>
  </div>
</form>

formController.php

public function uploadAction($uid, $id)
    {
        Utils::debug($this->request->hasFiles());  ===> return 0
        Utils::debug($this->request->getUploadedFiles()); ===> return []
    }

Maybe file is too large, check post_max_size and upload_max_filesize values in your php.ini
Else check your error log



4.3k
Accepted
answer
edited Jan '18

thanks, I found the problem , I forget to set an attr Name to my Input file :)