File upload problem

Hello, I tried upload my file but it $this->request->hasFiles() returns false. I tried to dump $_FILES but it returns array(0) { }. Please help me please. This is my code.

if ($this->request->isPost()) {
            echo "Check if the user has uploaded files";
            $path = '';
            if ($this->request->hasFiles() == true) {
                echo "Print the real file names and sizes";
                foreach ($this->request->getUploadedFiles() as $file) {
                    $path = 'files/test/'.$file->getName();
                    $ext = pathinfo($file->getName(), PATHINFO_EXTENSION);
                    echo $path;


Hi, code seems to be OK, so, double chek your form (is it defined as a POST method, as multipart ???)

your form how you defined it ? just check your form for more debugging