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

can't get $file->moveTo("/myFolder") to work

Hi there, When using $file->moveTo("/myFolder") where should the "myFolder" be ? I've tried in the webroot, in public folder also, but with no success.

File is sended but not saved ...



98.9k

The file is internally moved using the function move_uploaded_file (https://php.net/manual/en/function.move-uploaded-file.php), usually the current path is where the bootstrap file is located (public/index.php?), you can get your current path by calling getcwd() (https://www.php.net/manual/en/function.getcwd.php)



43.9k

Hi, thank you for help. I'm sorry, I can't get "moveTo" to work even by providing the file system path to "myFolder". But I've managed the task with move_uploaded_file($file->getTempName(), "images/".$file->getName());