diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 527a3ffaa3..0824b0a5ba 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -420,6 +420,7 @@ phutil_register_library_map(array( 'PhabricatorFileTransformController' => 'applications/files/controller/transform', 'PhabricatorFileURI' => 'applications/files/uri', 'PhabricatorFileUploadController' => 'applications/files/controller/upload', + 'PhabricatorFileUploadException' => 'applications/files/exception/upload', 'PhabricatorFileViewController' => 'applications/files/controller/view', 'PhabricatorGarbageCollectorDaemon' => 'infrastructure/daemon/garbagecollector', 'PhabricatorGoodForNothingWorker' => 'infrastructure/daemon/workers/worker/goodfornothing', diff --git a/src/applications/files/exception/upload/PhabricatorFileUploadException.php b/src/applications/files/exception/upload/PhabricatorFileUploadException.php new file mode 100644 index 0000000000..d48e2a4e36 --- /dev/null +++ b/src/applications/files/exception/upload/PhabricatorFileUploadException.php @@ -0,0 +1,43 @@ + + "Uploaded file is too large: file is larger than the ". + "'upload_max_size' setting in php.ini.", + UPLOAD_ERR_FORM_SIZE => + "File is too large.", + UPLOAD_ERR_PARTIAL => + "File was only partially transferred, upload did not complete.", + UPLOAD_ERR_NO_FILE => + "No file was uploaded.", + UPLOAD_ERR_NO_TMP_DIR => + "Unable to write file: temporary directory does not exist.", + UPLOAD_ERR_CANT_WRITE => + "Unable to write file: failed to write to temporary directory.", + UPLOAD_ERR_EXTENSION => + "Unable to upload: a PHP extension stopped the upload.", + ); + + $message = idx($map, $code, "Upload failed: unknown error."); + parent::__construct($message, $code); + } +} diff --git a/src/applications/files/exception/upload/__init__.php b/src/applications/files/exception/upload/__init__.php new file mode 100644 index 0000000000..23443df07a --- /dev/null +++ b/src/applications/files/exception/upload/__init__.php @@ -0,0 +1,12 @@ +