Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Upload File in API not Working

*<?php $app->post('/uploadAction', function ( ) use ( $app ) {

function uploadAction()
    if ($this->request->hasFiles() == true) {
        $baseLocation = 'files/';

        foreach ($this->request->getUploadedFiles() as $file) {
            $photos = new Photo();              
            $photos->name = $file->getName();
            $photos->size = $file->getSize();

            $file->moveTo($baseLocation . $file->getName());

}); ?>

<form action="uploadAction" method="POST" enctype="multipart/form-data"> <label>File</label> <input type="file" name="upFile"> <input type="submit" name="upload"> </form>*

I want to upload the file to files directory but it's not working. Please help me

edited Aug '17

And what exactly is not working? You have some error? File missing on a filesystem?

PHP version, PhalconPHP version? SAPI? OS?

You have mentioned API in the title, but you have provided HTML form instead?

When I upload a picture, the image does not go into the files folder. it's result error

You haven't provided any clues nor usable information.

Instead of providing more info for community to help you, you keep opening new threads on this issue, and those should be considered as spam IMO.

the image does not go into the files folder

Then check logs why it does not go into the files folder? There is reason why it doesn't go.