I have tried and tried to get this Rename filter to work to no avail
My workaround if it helps anyone was to intercept and modify the $_FILES
array before making the call to
Zend_File_Transfer_Adapter_Http()
if($form->isValid($_POST)) {
if(isset($_FILES['file1'])){
$ext = pathinfo($_FILES['file1']['name']);
$_FILES['file1']['name'] = 'image_' .
$userid.'.'.$ext[‘extension’];
}
$upload = new Zend_File_Transfer_Adapter_Http();
This worked. However this didn’t:
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Size', false, 200000, 'file1');
$upload->setDestination('/home/uglymen/public_html/tlp/tmp/');
$files = $upload->getFileInfo();
foreach ($files as $file => $info) {
if($upload->isValid($file)){
$ext = pathinfo($info[‘name’]);
$upload->addFilter('Rename', array($info['name'],'image_' .
$userid.'.'.$ext[‘extension’], true));
$upload->receive($file);
Does anyone have a working example of how to rename a file using the filter?
For large sites it is a necessity.
Thx for any pointers
Eric Haskins
--
View this message in context:
http://www.nabble.com/Zend_File_Transfer_Adapter_Http%28%29-Rename-Filter-issue-tp21823191p21823191.html
Sent from the Zend Framework mailing list archive at Nabble.com.