Not really the topic, but if you want your filenames to be unique, time() is quite not enough...

I use something like that instead :
$filepath = sha1(uniqid(rand(), true));

Mantasgl a écrit :
hi,
I'm trying to rename the uploaded file, but nothing works for me. Do i need
to rename the file before or after upload?. I try to change the name to
"time().jpg", to keep file names unique. After that I want to store file
name in the mysql DB.

I'm using zf 1.7.4

My source:
$element = new Zend_Form_Element_File('g_nuotrauka');
                $element->setLabel('Nuotrauka:')
                        ->setDestination(APPLICATION_PATH.'\images')
->addValidator('Count', false, 1) ->addValidator('Size', false, 204800) ->addValidator('Extension', false, 'jpg,png,gif')
                        ->setDecorators($this->_standardElementDecorator);
                $this->addElement($element, 'g_nuotrauka');

I tried to use addFilter('Rename') in file element and in my controller, but
nothing worked out.
What i'm dooing wrong?


Reply via email to