限制文件上传种类

This commit is contained in:
何童崇 2021-12-18 11:09:07 +08:00
parent 48fc4ce190
commit d7b879920a
2 changed files with 3 additions and 2 deletions

View File

@ -66,14 +66,14 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load,
function beforeUpload(file) {
const isLt100M = file.size / 1024 / 1024 < size;
const isMin = file.type === 'rar' || file.type === 'zip';
const isMin = file.type === 'application/zip' || file.type === 'application/zip';
if (!isLt100M) {
showNotification(`文件大小必须小于${size}MB!`);
}
if (!isMin) {
showNotification(`只能上传rar很zip文件`);
}
return isLt100M;
return isLt100M&&isMin;
}
const upload = {

View File

@ -413,6 +413,7 @@ export default Form.create()(({ match, history, showNotification, form, current_
<Modal
title="提交资料"
visible={cancelConfirmValue}
onOk={()=>{history.go(-1)}}
onCancel={() => setCancelConfirmValue(false)}
wrapClassName="expert_modal"
>