/**
  * @param Zend_Form_Element_File $element
  * @param $item mixed
  * @return mixed
  * @throws Exception
  *
  */
 public function saveUploadFile(Zend_Form_Element_File $element, $item)
 {
     $uploadPath = $element->getAttrib('data-upload') . '/' . $item->getId();
     if (!file_exists(APPLICATION_ROOT . $uploadPath)) {
         mkdir(APPLICATION_ROOT . $uploadPath, 0755, true);
     }
     //$element->setDestination(APPLICATION_ROOT.$uploadPath);
     $fileName = $element->getFileName(null, false);
     $path = APPLICATION_ROOT . $uploadPath . '/' . $fileName;
     $path = iconv('utf-8', 'cp1251', $path);
     try {
         $element->addFilter('Rename', array('target' => $path, 'overwrite' => true));
         $element->receive();
         $item->setOptions(array($element->getAttrib('data-input') => $uploadPath . '/' . $fileName));
         $this->getModelMapper()->save($item);
     } catch (Zend_File_Transfer_Exception $e) {
         throw new Exception('Bad image data: ' . $e->getMessage());
     }
     return $item;
 }