{"record":{"id":"2f98813bd4cb410b","repo":"phacility/phabricator","slug":"file-is-not-an-uploaded-file","errorCode":null,"errorMessage":"File is not an uploaded file.","messagePattern":"File is not an uploaded file\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/storage/PhabricatorFile.php","lineNumber":207,"sourceCode":"      throw new Exception(pht('No file was uploaded!'));\n    }\n\n    $err = idx($spec, 'error');\n    if ($err) {\n      throw new PhabricatorFileUploadException($err);\n    }\n\n    $tmp_name = idx($spec, 'tmp_name');\n\n    // NOTE: If we parsed the request body ourselves, the files we wrote will\n    // not be registered in the `is_uploaded_file()` list. It's fine to skip\n    // this check: it just protects against sloppy code from the long ago era\n    // of \"register_globals\".\n\n    if (ini_get('enable_post_data_reading')) {\n      $is_valid = @is_uploaded_file($tmp_name);\n      if (!$is_valid) {\n        throw new Exception(pht('File is not an uploaded file.'));\n      }\n    }\n\n    $file_data = Filesystem::readFile($tmp_name);\n    $file_size = idx($spec, 'size');\n\n    if (strlen($file_data) != $file_size) {\n      throw new Exception(pht('File size disagrees with uploaded size.'));\n    }\n\n    return $file_data;\n  }\n\n  public static function newFromPHPUpload($spec, array $params = array()) {\n    $file_data = self::readUploadedFileData($spec);\n\n    $file_name = nonempty(\n      idx($params, 'name'),","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/storage/PhabricatorFile.php#L189-L225","documentation":"Error \"File is not an uploaded file.\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/files/storage/PhabricatorFile.php:207 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":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}