octobercms/october · error · ApplicationException
File is not valid
Error message
File is not valid
What it means
Error "File is not valid" thrown in octobercms/october.
Source
Thrown at modules/backend/formwidgets/FileUpload.php:503
if ($fileTypes = $this->getAcceptedFileTypes()) {
$validationRules[] = 'extensions:'.$fileTypes;
}
if ($this->mimeTypes) {
$validationRules[] = 'mimes:'.$this->mimeTypes;
}
$validation = Validator::make(
['file_data' => $uploadedFile],
['file_data' => $validationRules]
);
if ($validation->fails()) {
throw new ValidationException($validation);
}
if (!$uploadedFile->isValid()) {
throw new ApplicationException('File is not valid');
}
$fileRelation = $this->getRelationObject();
// Check and clean vector files
// @deprecated v4 this should be moved to a post processing method on the file model
$extension = strtolower($uploadedFile->getClientOriginalExtension());
if ($extension === 'svg' && \Config::get('media.clean_vectors', true)) {
// getRealPath() can be empty for some environments (IIS)
$realPath = empty(trim($uploadedFile->getRealPath()))
? $uploadedFile->getPath() . DIRECTORY_SEPARATOR . $uploadedFile->getFileName()
: $uploadedFile->getRealPath();
\File::put($realPath, \Html::cleanVector(\File::get($realPath)));
}
$file = $fileModel;
$file->data = $uploadedFile;View on GitHub (pinned to b608633a7e)
When it happens
Trigger: Thrown at modules/backend/formwidgets/FileUpload.php:503 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/8fb1d6d2652a7374.
Report an issue: GitHub.