mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 07:48:41 +00:00
fix(web/image_hosting): image size calc
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0ecf295a38
commit
2e51c20d9f
@ -22,7 +22,7 @@
|
||||
die(json_encode(['status' => 'error', 'message' => $msg]));
|
||||
}
|
||||
|
||||
$allowedTypes = [IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF];
|
||||
$allowedTypes = [IMAGETYPE_PNG, IMAGETYPE_JPEG];
|
||||
if ($_POST['image_upload_file_submit'] == 'submit') {
|
||||
header('Content-Type: application/json');
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
imagepng($img, $_FILES["image_upload_file"]["tmp_name"]);
|
||||
imagedestroy($img);
|
||||
|
||||
if (filesize($_FILES["image_upload_file"]["tmp_name"]) > 5242880) { // 5 MB
|
||||
if (($size = filesize($_FILES["image_upload_file"]["tmp_name"])) > 5242880) { // 5 MB
|
||||
throwError('too_large');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user