I use Zend Form and upload file. I need to rename and user addFilter for it. But if I try to get extension of the file as in the code I get an error "Too much files, maximum '1' are allowed but '2' are given". If I try to get extension using $_FILES it looks like it can work out but it seems ugly. Could you please tell me how to rename file saving it's extension?
$form = new Form_ImportSubscribers();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)) {
//it looks like it works but it's ugly solution
// $extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
//causes an error "Too much files, maximum '1' are allowed but '2' are given"
$extension = pathinfo($form->file->getFileName(), PATHINFO_EXTENSION);
$form->file->addFilter('Rename', $accountId . '_' . time() . '.' . $extension);
if (!$form->file->receive()) {
$this->view->form = $form;
$this->view->listName = $list->list_name;
return;
}