mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 14:48:41 +00:00
fix(web/image_hosting): check file size after converting to png format
This commit is contained in:
parent
f21ee00a87
commit
b548dd071c
@ -81,6 +81,10 @@
|
||||
imagepng($img, $_FILES["image_upload_file"]["tmp_name"]);
|
||||
imagedestroy($img);
|
||||
|
||||
if (filesize($_FILES["image_upload_file"]["tmp_name"]) > 5242880) { // 5 MB
|
||||
throwError('too_large');
|
||||
}
|
||||
|
||||
$filename = uojRandAvaiableFileName('/image_hosting/', 10, '.png');
|
||||
if (!move_uploaded_file($_FILES["image_upload_file"]["tmp_name"], UOJContext::storagePath().$filename)) {
|
||||
throwError('unknown error');
|
||||
|
Loading…
Reference in New Issue
Block a user