This commit is contained in:
陈红丽 2024-12-18 15:55:19 +08:00
parent 05dd125357
commit ab50ef7786
2 changed files with 6 additions and 6 deletions

View File

@ -83,13 +83,13 @@
/**
* 上传文件之前验证
*/
const beforeUpload = (file) => {
const isLt2M = file.size / 1024 / 1024 < 200;
const beforeUpload = (rawFile) => {
const isLt2M = rawFile.file.file.size / 1024 / 1024 < 200;
if (!isLt2M) {
message.warning('大小不能超过200MB!');
return false;
}
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(rawFile.file.name)) {
message.warning('请上传.xlsx .xls');
return false;
}

View File

@ -84,13 +84,13 @@
/**
* 上传文件之前验证
*/
const beforeUpload = (file) => {
const isLt2M = file.size / 1024 / 1024 < 200;
const beforeUpload = (rawFile) => {
const isLt2M = rawFile.file.file.size / 1024 / 1024 < 200;
if (!isLt2M) {
message.warning('大小不能超过200MB!');
return false;
}
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(rawFile.file.name)) {
message.warning('请上传.xlsx .xls');
return false;
}