Skip to content

Instantly share code, notes, and snippets.

@phamquocbuu
Created November 22, 2013 09:13
Show Gist options
  • Save phamquocbuu/7597073 to your computer and use it in GitHub Desktop.
Save phamquocbuu/7597073 to your computer and use it in GitHub Desktop.
Zend Revieve Upload Image via File upload
$upload = new Zend_File_Transfer_Adapter_Http();
$uploaded_dir = APPLICATION_PATH.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'staff'.DIRECTORY_SEPARATOR.'photo'.DIRECTORY_SEPARATOR.$id;
if (!is_dir($uploaded_dir))
@mkdir($uploaded_dir, 0777, true);
$upload->setDestination($uploaded_dir);
// $upload->addFilter('Rename', APPLICATION_PATH.'/../public/images/avatars/'.$id.'.jpg');
try {
// This takes care of the moving and making sure the file is there
Zend_Debug::dump($upload->getFileInfo());
$upload->receive();
Zend_Debug::dump($upload->getFileInfo());
// Dump out all the file info
Zend_Debug::dump($upload->getFileInfo());
} catch (Zend_File_Transfer_Exception $e) {
echo $e->message();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment