57 private static array $systemErrors = [
58 self::INVALID_CONTENT_RANGE =>
'Content-Range header is invalid',
59 self::INVALID_CONTENT_TYPE =>
'Content-Type header is required.',
60 self::INVALID_CONTENT_LENGTH =>
'Content-Length header is required.',
61 self::INVALID_CONTENT_NAME =>
'X-Upload-Content-Name header is required.',
62 self::INVALID_FILENAME =>
'Filename is invalid.',
63 self::INVALID_RANGE_SIZE =>
'Range chunk file size (#rangeChunkSize#) is not equal Content-Length (#contentLength#).',
64 self::INVALID_CHUNK_SIZE =>
'Chunk file size (#chunkSize#) is not equal Content-Length (#contentLength#).',
65 self::INVALID_CHUNK_OFFSET =>
'Chunk offset is invalid.',
66 self::TOO_BIG_REQUEST =>
'The content length is too big to process the request.',
67 self::FILE_FIND_FAILED =>
'Could not find a file.',
68 self::FILE_MOVE_FAILED =>
'Could not move file.',
69 self::FILE_APPEND_NOT_FOUND =>
'File not found.',
70 self::CHUNK_NOT_FOUND =>
'Could not find chunk file.',
71 self::CHUNK_COPY_FAILED =>
'Could not copy chunk file.',
72 self::CHUNK_TOO_BIG =>
'You cannot upload a chunk more than the file size.',
73 self::CHUNK_APPEND_NOT_FOUND =>
'Could not find chunk.',
74 self::CHUNK_APPEND_FAILED =>
'Could not put contents to file.',
75 self::CLOUD_EMPTY_BUCKET =>
'Could not get the cloud bucket.',
76 self::CLOUD_INVALID_CHUNK_SIZE =>
'Cannot upload file to cloud. The size of the chunk (#chunkSize#) must be more than #minUploadSize#. Check "post_max_size" (#postMaxSize#) and "upload_max_filesize" (#uploadMaxFileSize#) options in php.ini.',
77 self::CLOUD_GET_CONTENTS_FAILED =>
'Could not get file contents.',
78 self::CLOUD_START_UPLOAD_FAILED =>
'Could not start cloud upload.',
79 self::CLOUD_FINISH_UPLOAD_FAILED =>
'Could not finish cloud upload.',
80 self::CLOUD_UPLOAD_FAILED =>
'Could not upload file for #fails# times.',
81 self::EMPTY_TOKEN =>
'Could not append content to file. Have to set token parameter.',
82 self::UNKNOWN_TOKEN =>
'Could not find file by token.',
83 self::INVALID_SIGNATURE =>
'Token signature is invalid.',
88 $message = isset($args[0]) && is_string($args[0]) ? $args[0] :
null;
89 $description = isset($args[1]) && is_string($args[1]) ? $args[1] :
null;
90 $lastIndex = count($args) - 1;
91 $customData = isset($args[$lastIndex]) && is_array($args[$lastIndex]) ? $args[$lastIndex] : [];
96 $replacements[
"#{$key}#"] = $value;
99 if (isset(self::$systemErrors[
$code]))
102 foreach ($replacements as $search => $repl)
159 'type' =>
'file-uploader',
static loadLanguageFile($file, $language=null, $normalize=true)
static getMessage($code, $replace=null, $language=null)