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 moveTo not copying a file

public function profilePictureAction()
{
    // Check if the user has uploaded files
    if ($this->request->hasFiles()) {

        // Print the real file names and sizes
        foreach ($this->request->getUploadedFiles() as $file) {

            // Print file details
            echo $file->getName(), " ", $file->getSize(), "\n";

            // Move the file into the application
            $file->moveTo('files/' . $file->getName());

        }
    }
}

this is my code I upload file using postman with form type: form-data and with image png. In my app directory I already create directory named files after projectname and in one directory with app, public folder. Why this happen? I expecting file copied after I send image data.



42.8k
Accepted
answer

Do you have some errors, somewhere? This issue is due to bad permissions 99%.



572

I already chmod 755 files folder and chown :www-data and chown my-username no error its output is icon-testing.png 6773 image name and image size but not uploaded to files folder in my app.. how to solve bad permissions? Thank you..

Do you have some errors, somewhere? This issue is due to bad permissions 99%.



572

change other access: create and delete files



2.3k

I looked for this issue for a while aswell, so for anyone searching for this problem and that doesnt have read write execute issues, ifound the answer here: https://forum.phalconphp.com/discussion/1947/phalcon-don-t-recognize-html5-multiple-file-upload

For me it was the missing enctype in the form

{{ form('post/add', 'method': 'post', 'enctype': "multipart/form-data",'class':'form-post') }}