Hi Jacky,

If you add a filter like this:

$adapter->addFilter('Rename', array('C:/upload/image/image_' .
$member->member_id, true));

it will retain the file extension of the file that was uploaded. I use the
above code to just change the file name too but keep the extension.

These are the validators that I set and that work well for me:
                $adapter->addValidator('Extension', array('gif', 'jpg'))
                        ->addValidator('Size', '10kB')
                        ->addValidator('FilesSize', '10kB')
                        ->addValidator('Count', 1)
                        ->addValidator('ImageSize', array(60, 60, 320, 240))
                        ->addValidator('MimeType', array('image/jpeg',
'image/gif'))
                        ->setDestination('C:/upload/image/');



Jacky Chen-2 wrote:
> 
> Sorry,
> 
> the code $upload->addFilter('cba.js',true) incorrect.
> it should be $upload->addFilter('rename',array('cba.jpg', true));
> 
> 2008/9/11 Jacky Chen <[EMAIL PROTECTED]>
> 
>> Hi guy,
>>
>> Let's say that i want to rename the upload file abc.jpg to cba.jpg just
>> after the file is complete upload in the form,how can i add the rename
>> filter to the form?
>> of course,i can add the filter like this $upload->addFilter('cba.jpg',
>> true) if i know that the file that would be upload is a jpg file,but
>> problem
>> is,i don't know what type file would be upload,may be jpg,gif,pdf,or
>> zip,etc.
>> And i found that the file rename filter doesn't deal with the file
>> extension.
>>
>> Sorry for my poor english.Thanks.
>>
>> Best Regards.
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/about-file-rename-filter-tp19427725p19651930.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to