Location: PHPKode > projects > GnomePHP > peec-GnomePHP-b5a360b/gnomephp/input/UploadException.php
<?php
namespace gnomephp\input;

class UploadException extends \Exception{

	const DOTDOT_FAILURE = 10001;
	const MOVE_UPLOAD_FAILURE = 10002;


	public function __construct($code) {
		$message = $this->codeToMessage($code);
		parent::__construct($message, $code);
	}

	private function codeToMessage($code)
	{
		switch ($code) {
			case UPLOAD_ERR_INI_SIZE:
				$message = "The uploaded file exceeds the upload_max_filesize directive in php.ini";
				break;
			case UPLOAD_ERR_FORM_SIZE:
				$message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form";
				break;
			case UPLOAD_ERR_PARTIAL:
				$message = "The uploaded file was only partially uploaded";
				break;
			case UPLOAD_ERR_NO_FILE:
				$message = "No file was uploaded";
				break;
			case UPLOAD_ERR_NO_TMP_DIR:
				$message = "Missing a temporary folder";
				break;
			case UPLOAD_ERR_CANT_WRITE:
				$message = "Failed to write file to disk";
				break;
			case UPLOAD_ERR_EXTENSION:
				$message = "File upload stopped by extension";
				break;
			case self::DOTDOT_FAILURE:
				$message = "Filename consist of illegal characters. Two dot's (..) is not allowed in the filename.";
				break;
			case self::MOVE_UPLOAD_FAILURE:
				$message = "Unable to move file to upload location.";
				break;

			default:
				$message = "Unknown upload error";
				break;
		}
		return $message;
	}
}
Return current item: GnomePHP