We're building an application within Zend framework and are having trouble moving an uploaded file. We get the file by $filePath = $form->image->getFileName(); but when we're trying to run move_uploaded_file on it, it just returns false.
The image is successfully being uploaded to the temp directory, but we can't move it into a folder.
$formData = $request->getPost();
if ($form->isValid($formData))
{
$form->image->receive();
$filePath = $form->image->getFileName();
move_uploaded_file($filePath,APPLICATION_PATH . '\images\new');
}
Thanks in advance
EDIT:
When I try this, I get 500 - internal server error:
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination("C:\xx\xx\public\banners");
if (!$upload->isValid())
{
throw new Exception('Bad image data: '.implode(',', $upload->getMessages()));
}
try {
$upload->receive();
}
catch (Zend_File_Transfer_Exception $e)
{
throw new Exception('Bad image data: '.$e->getMessage());
}
It seems that it is the " $upload->setDestination("C:\xx\xx\public\banners"); " that cause the crash