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

How To Upload Image Phalcon? PLease Help Me

PLease Help Me. how to uploading image in phalcon?

for one file:

if($this->request->isPost()) {

    $picture = $this->request->getUploadedFiles()[0];

    // If uploaded
    if (!$picture->getError()) {
        $picture->moveTo('path/to/save/' . $picture->getName());
    }

}

for several files:

if($this->request->isPost()) {

    foreach($this->request->getUploadedFiles() as $picture) {

        if(!$picture->getError()) {

            $picture->moveTo('path/to/save/' . $picture->getName());

        }
    }

}

In template:

<form action="" method="post" enctype="multipart/form-data">
    ...
    <input type="file" name="my_picture">
    ...
    <input type="submit" value="Upload">
</form>