You don't need to extend the rename filter.

Just take a look at the mailing lists archive. This question was asked and answered about 3-5 times in past and code was also provided.

Do you really think that we have build the filter in a way where also the base class have to be extended ?

When you don't get the clue what getNewName does and why the parameters are given in that way then you should not change the classes. Else you will have massive other problems when you do this.

Hint:
Keep in mind how a upload is processed... upload -> validate -> filter -> move... so why should the original name be provided when the related file does not exist at this time ?

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "Muhammad Ali" <imjob....@live.com>
To: <pe...@peterwarnock.com>
Cc: <fw-general@lists.zend.com>
Sent: Tuesday, July 21, 2009 3:58 AM
Subject: Re: [fw-general] Zend_Form_Element_File and random files name


Hi Pete,

So far my findings are as follows

In Zend_File_Transfer_Adapter_Http line 163 contains following code

                   $filename = $rename->getNewName($content['tmp_name']);

as you can see only temp file name is sent to the filter, there is nothing much I can do here based on the original filename sent by the user. For what I want to implement I have to change both Zend_File_Transfer_Adapter_Http and a custom filter.

I think I would upload the file and rename is directly from the code using a filter or something within the controller.

Thanks anyway.


From: Peter Warnock
Sent: Tuesday, July 21, 2009 2:06 AM
To: Muhammad Ali
Subject: Re: [fw-general] Zend_Form_Element_File and random files name


I haven't done it, but I would think extending the bfilter class with a custom implementation would do the trick. - pw


 On Jul 20, 2009 6:04 PM, "Muhammad Ali" <imjob....@live.com> wrote:


 Hi Pete,

Thanks for that, but there is no option to ignore extension i.e. so that extension are taken care of as for now you I can set new file name to time() but it don't seems to keep the extension. Or do i have to do my own filter for this purpose?

 Thanks


 From: Peter Warnock
 Sent: Tuesday, July 21, 2009 12:38 AM
 To: Muhammad Ali
 Subject: Re: [fw-general] Zend_Form_Element_File and random files name
Take a look at http://framework.zend.com/manual/en/zend.file.transfer.filters.html#zend.file.trans...


Reply via email to