I'm trying to uplaod a file, and move it to a folder that is not publicly accessible. I'm doing via an ajax uploader for some wiki code that we moved over to phalcon. I seem to get all the way to the upload, Chrome indicates that the file is uploading, but the return says the file was not uploaded. I'm hoping I just screwed up the permissions.
In my application folder, same dir level as the app folder, I have the target folder. Permissions are:
drwxrwxrwx 2 www-data www-data 12288 Apr 26 11:21 wikiFiles
My function:
public function upload_fileAction($wiki_word)
{
#check if there is any file
if( $this->request->hasFiles() == true )
{
$uploads = $this->request->getUploadedFiles();
$isUploaded = false;
die( var_dump($uploads));
#do a loop to handle each file individually
foreach($uploads as $upload)
{
$path = BASE_PATH . '/wikiFiles/' . strtolower( $upload->getname() );
#move the file and simultaneously check if everything was ok
( $upload->moveTo($path) ) ? $isUploaded = true : $isUploaded = false;
}
#if any file couldn’t be moved, then throw an message
( $isUploaded ) ? '' : die( $path . ' ' . 'A file upload error ocurred.' );
}
else
{
#if no files were sent, throw a message warning user
die('You must choose at least one file to send. Please try again.');
}
//Disable the view so it won't try to show a view for THIS Controller/Action
$this->view->disable();
}
The response msg is: "/var/www/html/myApp/wikiFiles/testcapture.png A file upload error ocurred."