//excerpt
$file = new Zend_Form_Element_File(\'file\');
$file->setLabel(\'File to upload:\')
->setRequired(true)
->addValidator(\'NotEmp
You can use Rename filter. If you want to rename your filename during uploading maybe it helps you.
First we need a function rename or remove unwanted characters from your filename for example use this.
public function simple_fileformat($str)
{
$str = preg_replace("{[^A-Za-z0-9_]\.}", "", $str);
$str = str_replace(" ", "_", $str);
return $str;
}
After that you can use the above function for renaming.
$filename = new Zend_Form_Element_File("filename");
$filename->setLabel("filename");
$filename->setRequired(true);
$filename->setDestination($doc_path);
$filename->addFilter("rename", $doc_path . DIRECTORY_SEPARATOR . $this->simple_fileformat(basename($filename->getFileName())));
That is easy. Is not it?