上传
This commit is contained in:
parent
05dd125357
commit
ab50ef7786
@ -83,13 +83,13 @@
|
|||||||
/**
|
/**
|
||||||
* 上传文件之前验证
|
* 上传文件之前验证
|
||||||
*/
|
*/
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = (rawFile) => {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 200;
|
const isLt2M = rawFile.file.file.size / 1024 / 1024 < 200;
|
||||||
if (!isLt2M) {
|
if (!isLt2M) {
|
||||||
message.warning('大小不能超过200MB!');
|
message.warning('大小不能超过200MB!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
|
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(rawFile.file.name)) {
|
||||||
message.warning('请上传.xlsx .xls');
|
message.warning('请上传.xlsx .xls');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -84,13 +84,13 @@
|
|||||||
/**
|
/**
|
||||||
* 上传文件之前验证
|
* 上传文件之前验证
|
||||||
*/
|
*/
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = (rawFile) => {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 200;
|
const isLt2M = rawFile.file.file.size / 1024 / 1024 < 200;
|
||||||
if (!isLt2M) {
|
if (!isLt2M) {
|
||||||
message.warning('大小不能超过200MB!');
|
message.warning('大小不能超过200MB!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
|
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(rawFile.file.name)) {
|
||||||
message.warning('请上传.xlsx .xls');
|
message.warning('请上传.xlsx .xls');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user