拖拽上传文件夹

This commit is contained in:
caishi 2022-04-20 17:14:14 +08:00
parent 04e10722e3
commit a3c6ad78ee
1 changed files with 15 additions and 10 deletions

View File

@ -61,13 +61,10 @@ class Index extends Component {
handleChange = (info) => {
const { changeIsComplete } = this.props;
changeIsComplete && changeIsComplete(true);
const file = info.file;
if(file && file.type){
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) });
this.fileIdList(fileList);
}
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) });
this.fileIdList(fileList);
}
}
@ -80,10 +77,18 @@ class Index extends Component {
}
beforeUpload = (file) => {
console.log(file);
if(file && !file.type){
this.props.showNotification(`暂不支持此格式文件的上传!`);
return;
let name = file.name;
const filestr = ['.rar','.iso',".flv", ".rmvb", ".mmf", ".ape"];
let flag = false;
for(var i= 0;i<filestr.length;i++){
let reg = new RegExp("(.+(?=["+filestr[i]+"]$))");
flag = reg.test(name);
}
if(!flag){
this.props.showNotification(`暂不支持此格式文件的上传!`);
return;
}
}
const { size } = this.props;
const isLt100M = file.size / 1024 / 1024 < size;