diff options
author | Mandragorat Wandystanu <wktir@wandystan.eu> | 2018-05-30 16:04:58 +0200 |
---|---|---|
committer | Mandragorat Wandystanu <wktir@wandystan.eu> | 2018-05-30 16:04:58 +0200 |
commit | 091ce97096d54232ab28408202f877312e0155dd (patch) | |
tree | 76d6e432291c060770d29e214dfb8551a7172a7a | |
parent | 9e04052b048892b12daf562d11c1cb9776ee0987 (diff) |
upload.php: Send 415 status code when uploaded file has forbidden MIME type.
-rw-r--r-- | static/php/upload.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/static/php/upload.php b/static/php/upload.php index c8bae73..39a13d9 100644 --- a/static/php/upload.php +++ b/static/php/upload.php @@ -92,11 +92,17 @@ function uploadFile($file) if (!empty($FILTER_MIME)) { if ($FILTER_MODE == true) { //whitelist mode if (!in_array($file->mime, $FILTER_MIME)) { - throw new UploadException(UPLOAD_ERR_EXTENSION); + throw new Exception( + 'Niedozwolony format pliku', + 415 + ); // HTTP status code "415 Unsupported Media Type" } } else { // blacklist mode if (in_array($file->mime, $FILTER_MIME)) { - throw new UploadException(UPLOAD_ERR_EXTENSION); + throw new Exception( + 'Niedozwolony format pliku', + 415 + ); // HTTP status code "415 Unsupported Media Type" } } } |