/**
  * "Upload" handler for category images.
  *
  * @return void
  */
 protected function doActionSelectUploadLanguageFile()
 {
     $result = null;
     $error = null;
     $message = null;
     $key = 'uploaded_file';
     $cell = isset($_FILES[$key]) ? $_FILES[$key] : null;
     if ($cell) {
         $size = null;
         switch ($cell['error']) {
             case UPLOAD_ERR_OK:
                 $path = \Includes\Utils\FileManager::getUniquePath(LC_DIR_TMP, $cell['name']);
                 if (move_uploaded_file($cell['tmp_name'], $path)) {
                     $result = $path;
                 }
                 break;
             case UPLOAD_ERR_INI_SIZE:
                 $size = ini_get('upload_max_filesize');
             case UPLOAD_ERR_FORM_SIZE:
                 $size = $size ?: \XLite\Core\Request::getInstance()->MAX_FILE_SIZE;
                 $error = 'File size exceeds the maximum size (' . $size . ')';
                 $size = \XLite\Core\Converter::convertShortSizeToHumanReadable($size);
                 $message = \XLite\Core\Translation::lbl('File size exceeds the maximum size', array('size' => $size));
                 break;
             case UPLOAD_ERR_PARTIAL:
                 $error = 'The uploaded file was only partially uploaded';
             case UPLOAD_ERR_NO_FILE:
                 $error = $error ?: 'No file was uploaded';
             case UPLOAD_ERR_NO_TMP_DIR:
                 $error = $error ?: 'Missing a temporary folder';
             case UPLOAD_ERR_CANT_WRITE:
                 $error = $error ?: 'Failed to write file to disk';
             case UPLOAD_ERR_EXTENSION:
                 $message = \XLite\Core\Translation::lbl('The file was not loaded because of a failure on the server.');
                 $error = $error ?: 'File upload stopped by extension';
                 break;
             default:
         }
     }
     if ($result && $message) {
         \XLite\Logger::getInstance()->log('Upload file error: ' . $error ?: $message, LOG_ERR);
     }
     $this->doActionSelectLanguageFile($result, $message);
 }
 /**
  * Defines the message for uploading files
  * 
  * @return string
  */
 protected function getUploadFileMessage()
 {
     $filesize = \XLite\Core\Converter::getUploadFileMaxSize();
     return static::t('The maximum file size that can be uploaded: X', array('upload_max_filesize' => \XLite\Core\Converter::convertShortSizeToHumanReadable($filesize)));
 }