From be85d8aad3bf3483de9b8bc409337b7252e94059 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Sun, 19 Jun 2016 20:38:56 +1000 Subject: Introduce mime type whitelist --- php/upload.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'php/upload.php') diff --git a/php/upload.php b/php/upload.php index a189f87..7ea89ff 100644 --- a/php/upload.php +++ b/php/upload.php @@ -84,6 +84,10 @@ function uploadFile($file) if (!in_array(mime_content_type($file), $FILTER_MIME)) { throw new UploadException(UPLOAD_ERR_EXTENSION); } + if $WHITELIST == true { + if (!in_array(mime_content_type($file), $WHITELIST_MIME)) { + throw new UploadException(UPLOAD_ERR_EXTENSION); + } // Check if a file with the same hash and size (a file which is the same) -- cgit v1.2.3