RSS

Monthly Archives: August 2011

Renaming file name in the file uploading process in ZF

The following code works for me to rename a file name in the uploading process in zend framework.


$fileTransferObject = new Zend_File_Transfer_Adapter_Http();
$uploadDir = 'your_upload_directory';

$fileTransferObject->setDestination($uploadDir);

$renameFilter = new Zend_Filter_File_Rename( $uploadDir );
$files = $fileTransferObject->getFileInfo();
$time = microtime();
$timeArray = explode(‘ ‘ , $time);
$timeStr = $timeArray[1];
foreach($files as $fileID => $fileInfo)
{
if(!$fileInfo[‘name’]==”)
{
$renameFilter->addFile( array(‘source’ => $fileInfo[‘tmp_name’], ‘target’ => $timeStr.’_’.$fileInfo[‘name’], ‘overwrite’ => true ) );
}
}
$fileTransferObject->addFilter($renameFilter);
//check file recieved successful.
if (!$fileTransferObject->receive()) {
$messages = $fileTransferObject->getMessages();
}

Advertisements
 
Leave a comment

Posted by on August 8, 2011 in ZF

 

Tags: , ,

Easy way to find facebook page admin or user id

Facebook Like Box and some other plugins require admin id for meta information.

Suppose for like button plugin required admins id in the meta information:
So if you create your page by your facebook account then at first login to facebook. Find account tab from the top right navigation bar. Click on down arrow symbol besides account and then click on account settings. Then you will find

Username : http://www.facebook.com/your_id_name
So your_id_name is your admin id or user id.

 
Leave a comment

Posted by on August 1, 2011 in Face Book