Merge pull request #73 from xjrjyy/patch-1

解决火狐浏览器上传数据“请上传zip格式!”问题
This commit is contained in:
billchenchina 2021-01-24 01:39:36 +08:00 committed by GitHub
commit 87749adb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,7 @@
becomeMsgPage('<div>' . $errmsg . '</div><a href="/problem/'.$problem['id'].'/manage/data">返回</a>'); becomeMsgPage('<div>' . $errmsg . '</div><a href="/problem/'.$problem['id'].'/manage/data">返回</a>');
} else { } else {
$zip_mime_types = array('application/zip', 'application/x-zip', 'application/x-zip-compressed'); $zip_mime_types = array('application/zip', 'application/x-zip', 'application/x-zip-compressed');
if (in_array($_FILES["problem_data_file"]["type"], $zip_mime_types)) { if (in_array($_FILES["problem_data_file"]["type"], $zip_mime_types) || $_FILES["problem_data_file"]["type"] == 'application/octet-stream' && substr($_FILES["problem_data_file"]["name"], -4) == '.zip') {
$up_filename="/tmp/".rand(0,100000000)."data.zip"; $up_filename="/tmp/".rand(0,100000000)."data.zip";
move_uploaded_file($_FILES["problem_data_file"]["tmp_name"], $up_filename); move_uploaded_file($_FILES["problem_data_file"]["tmp_name"], $up_filename);
$zip = new ZipArchive; $zip = new ZipArchive;