i am new to phalcon and i'm stuck at file uploading in phalcon.
so i googled some basic things but none of those worked , i need someone who can help me to solve this
This is my form | volt file:
<form action="/user/upload" method="post" enctype="multipart/form-data">
<!-- <input type="file" name="my_picture" >
--><label>File</label>
<input type="file" name="upFile" class="form-control">
<input type="submit" class="btn btn-warning" style="margin-top:15px;" value="Upload">
</form>
This is my controller:
```public function uploadAction() {
$this->view->disable();
if ($this->request->hasFiles() == true) {
foreach ($this->request->getUploadedFiles() as $file){
$upload_dir = DIR . '/../../app/public/img/';
$file->moveTo($upload_dir . $file->getName());
echo $file->getName(), '\n';
}
} else {
echo 'File not uploaded';
}
}
When i var_dump($file);
i got this :
002.jpg\nobject(Phalcon\Http\Request\File)#48 (8) { ["_name":protected]=> string(7) "002.jpg" ["_tmp":protected]=> string(0) "" ["_size":protected]=> int(0) ["_type":protected]=> string(0) "" ["_realType":protected]=> NULL ["_error":protected]=> int(3) ["_key":protected]=> string(6) "upFile" ["_extension":protected]=> string(3) "jpg"}