X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fzendframework%2Fzend-diactoros%2Fsrc%2FUploadedFile.php;fp=vendor%2Fzendframework%2Fzend-diactoros%2Fsrc%2FUploadedFile.php;h=f1f34aec53f8322b2e14b29ba3714416a8c11c58;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=767724b8a9a9174a340facf8c5db3003a525b7c2;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/zendframework/zend-diactoros/src/UploadedFile.php b/vendor/zendframework/zend-diactoros/src/UploadedFile.php index 767724b8a..f1f34aec5 100644 --- a/vendor/zendframework/zend-diactoros/src/UploadedFile.php +++ b/vendor/zendframework/zend-diactoros/src/UploadedFile.php @@ -1,9 +1,7 @@ 'There is no error, the file uploaded with success', + UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', + UPLOAD_ERR_FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was ' + . 'specified in the HTML form', + UPLOAD_ERR_PARTIAL => 'The uploaded file was only partially uploaded', + UPLOAD_ERR_NO_FILE => 'No file was uploaded', + UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder', + UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', + UPLOAD_ERR_EXTENSION => 'A PHP extension stopped the file upload.', + ]; + /** - * @var string + * @var string|null */ private $clientFilename; /** - * @var string + * @var string|null */ private $clientMediaType; @@ -114,7 +124,10 @@ class UploadedFile implements UploadedFileInterface public function getStream() { if ($this->error !== UPLOAD_ERR_OK) { - throw new RuntimeException('Cannot retrieve stream due to upload error'); + throw new RuntimeException(sprintf( + 'Cannot retrieve stream due to upload error: %s', + self::ERROR_MESSAGES[$this->error] + )); } if ($this->moved) { @@ -147,7 +160,10 @@ class UploadedFile implements UploadedFileInterface } if ($this->error !== UPLOAD_ERR_OK) { - throw new RuntimeException('Cannot retrieve stream due to upload error'); + throw new RuntimeException(sprintf( + 'Cannot retrieve stream due to upload error: %s', + self::ERROR_MESSAGES[$this->error] + )); } if (! is_string($targetPath) || empty($targetPath)) {