Created
November 22, 2013 09:13
-
-
Save phamquocbuu/7597073 to your computer and use it in GitHub Desktop.
Zend Revieve Upload Image via File upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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