{"record":{"id":"8fb1d6d2652a7374","repo":"octobercms/october","slug":"file-is-not-valid","errorCode":null,"errorMessage":"File is not valid","messagePattern":"File is not valid","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/formwidgets/FileUpload.php","lineNumber":503,"sourceCode":"            if ($fileTypes = $this->getAcceptedFileTypes()) {\n                $validationRules[] = 'extensions:'.$fileTypes;\n            }\n\n            if ($this->mimeTypes) {\n                $validationRules[] = 'mimes:'.$this->mimeTypes;\n            }\n\n            $validation = Validator::make(\n                ['file_data' => $uploadedFile],\n                ['file_data' => $validationRules]\n            );\n\n            if ($validation->fails()) {\n                throw new ValidationException($validation);\n            }\n\n            if (!$uploadedFile->isValid()) {\n                throw new ApplicationException('File is not valid');\n            }\n\n            $fileRelation = $this->getRelationObject();\n\n            // Check and clean vector files\n            // @deprecated v4 this should be moved to a post processing method on the file model\n            $extension = strtolower($uploadedFile->getClientOriginalExtension());\n            if ($extension === 'svg' && \\Config::get('media.clean_vectors', true)) {\n                // getRealPath() can be empty for some environments (IIS)\n                $realPath = empty(trim($uploadedFile->getRealPath()))\n                    ? $uploadedFile->getPath() . DIRECTORY_SEPARATOR . $uploadedFile->getFileName()\n                    : $uploadedFile->getRealPath();\n\n                \\File::put($realPath, \\Html::cleanVector(\\File::get($realPath)));\n            }\n\n            $file = $fileModel;\n            $file->data = $uploadedFile;","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/formwidgets/FileUpload.php#L485-L521","documentation":"Error \"File is not valid\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/formwidgets/FileUpload.php:503 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}