Skip to content
Snippets Groups Projects
Commit 9ce9d613 authored by Florian Azizian's avatar Florian Azizian
Browse files

Add check type = image

parent 24970016
No related branches found
No related tags found
No related merge requests found
......@@ -129,7 +129,9 @@ class UserController
}
$ext = strtoupper(substr($data['name'], strrpos($data['name'], '.') + 1));
if (empty($extensionTypes[$ext]) || $extensionTypes[$ext] != $data['type']) {
$mimeType = explode('/', $data['type']);
if (empty($extensionTypes[$ext]) || $extensionTypes[$ext] != $data['type'] || $mimeType[0] != 'image') {
return $response->withJson(['errors' => _WRONG_FILE_TYPE]);
} elseif ($data['size'] > 2000000){
return $response->withJson(['errors' => _MAX_SIZE_UPLOAD_REACHED . ' (2 MB)']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment