summaryrefslogtreecommitdiff
path: root/php/upload.php
diff options
context:
space:
mode:
authorEliot Whalan <ewhal@pantsu.cat>2016-06-19 12:38:56 +0200
committerEliot Whalan <ewhal@pantsu.cat>2016-06-19 12:38:56 +0200
commitbe85d8aad3bf3483de9b8bc409337b7252e94059 (patch)
tree0fafb7d0e973ddc0eba2e9898428565e295128f2 /php/upload.php
parent1ada6d94988cc182039c04b21f5209b0dc25e4cb (diff)
Introduce mime type whitelist
Diffstat (limited to 'php/upload.php')
-rw-r--r--php/upload.php4
1 files changed, 4 insertions, 0 deletions
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)