/** * Gets the correct error message. * * Methoed tries to use $lang-Object. If not available, hardcoded english phrases will be used. * * @return string error message */ function get_error() { if ($this->error == null) { return false; } $lang = new lang(); $lang->group("classes"); switch ($this->error) { case UPLOAD_ERR_FILE_INDEX: $message = $lang->phrase('upload_error_noupload'); break; case UPLOAD_ERR_FILE_SIZE: $lang->assign('mfs', formatFilesize($this->max_filesize)); $message = $lang->phrase('upload_error_maxfilesize'); break; case UPLOAD_ERR_IMAGE_WIDTH: case UPLOAD_ERR_IMAGE_HEIGHT: $lang->assign('mih', $this->max_image_height > 0 ? numbers($this->max_image_height) : $lang->phrase('upload_unspecified')); $lang->assign('miw', $this->max_image_width > 0 ? numbers($this->max_image_width) : $lang->phrase('upload_unspecified')); $message = $lang->phrase('upload_error_maximagesize'); break; case UPLOAD_ERR_FILE_TYPE: $lang->assign('aft', implode(', ', $this->file_types)); $message = $lang->phrase('upload_error_wrongfiletype'); break; case UPLOAD_ERR_COPY: $message = $lang->phrase('upload_error_noaccess'); break; case UPLOAD_ERR_FILE_EXISTS: $message = $lang->phrase('upload_error_fileexists'); break; default: $message = $lang->phrase('upload_error_default'); } if (!empty($this->file['name'])) { return "{$this->file['name']}: {$message}"; } else { return $message; } }