diff options
| author | Eliot Whalan <ewhal@pantsu.cat> | 2016-06-19 12:34:48 +0200 |
|---|---|---|
| committer | Eliot Whalan <ewhal@pantsu.cat> | 2016-06-19 12:34:48 +0200 |
| commit | 1ada6d94988cc182039c04b21f5209b0dc25e4cb (patch) | |
| tree | 54cb81e40fcd856561c1d5488ad3c6bc8604e299 /php/upload.php | |
| parent | 6709605ca4712d669ec9b82eb50a2781aa8d2b38 (diff) | |
Introduce mime type file blocking
Diffstat (limited to 'php/upload.php')
| -rw-r--r-- | php/upload.php | 6 |
1 files changed, 6 insertions, 0 deletions
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. |
