I have form where user can upload an image. I am working locally and when a user uploads a photo it added in the temp folder then I need to move it to folder inside the project. I need to know how to do this in live server.
Thanks
I have form where user can upload an image. I am working locally and when a user uploads a photo it added in the temp folder then I need to move it to folder inside the project. I need to know how to do this in live server.
Thanks
If you want to do it with Zend Framework, use Zend_Filter_File_Rename:
$moveTo = '/uploads';
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Count', false, array('min' => 1, 'max' => 1))
->addValidator('Size', false, array('max' => '2000kB'))
->setDestination($moveTo);
if (!$upload->isValid()) {
return false;
}
$upload->receive();
$name = $upload->getFileName();
$newFile = "nefile.png";
$filterFileRename = new Zend_Filter_File_Rename(array(
'target' => $moveTo . '/' . $nefile;
'overwrite' => true
));
$file = $filterFileRename->filter($name);