Ejemplo n.º 1
0
 private function checkUploadError($file)
 {
     if (!isset($file['error'])) {
         $this->addError(_('Unknown error.'));
     } else {
         if ($file['error'] === UPLOAD_ERR_NO_FILE) {
             $this->addError(_('No Files has been uploaded.'));
         } else {
             if ($file['error'] === UPLOAD_ERR_PARTIAL) {
                 $this->addError(_('The file has been partially uploaded.'));
             } else {
                 if ($file['error'] === UPLOAD_ERR_INI_SIZE) {
                     $error = _("You can’t upload a file bigger than %d octets.");
                     $max = Ftp::octetConverter(ini_get('upload_max_filesize'));
                     $this->addError(sprintf($error, $max));
                 } else {
                     if ($file['error'] === UPLOAD_ERR_FORM_SIZE) {
                         $this->addError(_("The file’s size is bigger than the maximum size " . "specified in the form."));
                     } else {
                         if ($file['error'] === UPLOAD_ERR_NO_TMP_DIR) {
                             $this->addError(_('The temporary directory is missing.'));
                         } else {
                             if ($file['error'] === UPLOAD_ERR_CANT_WRITE) {
                                 $this->addError(_("The file can’t be wrote on the disk."));
                             } else {
                                 if ($file['error'] === UPLOAD_ERR_EXTEMSION) {
                                     $this->addError(_('The file’s extention is not allowed.'));
                                 } else {
                                     $this->addError(_('Unknown error.'));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }