From 1ada6d94988cc182039c04b21f5209b0dc25e4cb Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Sun, 19 Jun 2016 20:34:48 +1000 Subject: Introduce mime type file blocking --- php/upload.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'php/upload.php') diff --git a/php/upload.php b/php/upload.php index 476120b..a189f87 100644 --- a/php/upload.php +++ b/php/upload.php @@ -80,6 +80,12 @@ function uploadFile($file) throw new UploadException($file->error); } + // Check if mime type is blocked + if (!in_array(mime_content_type($file), $FILTER_MIME)) { + throw new UploadException(UPLOAD_ERR_EXTENSION); + } + + // Check if a file with the same hash and size (a file which is the same) // does already exist in the database; if it does, return the proper link // and data. PHP deletes the temporary file just uploaded automatically. -- cgit v1.2.3