代码库上传文件限制文件类型

This commit is contained in:
谢思 2022-11-29 16:46:33 +08:00
parent 4f05ce683a
commit 28e0afedef
1 changed files with 8 additions and 4 deletions

View File

@ -49,6 +49,10 @@ class Read extends Component {
"psd",
"cdr",
"webp",
"vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"vnd.ms-powerpoint",
"vnd.openxmlformats-officedocument.presentationml.presentation",
"vnd.ms-excel"
];
const { fileList } = this.state;
const { size } = this.props;
@ -59,7 +63,7 @@ class Read extends Component {
} else if (!isLt100M) {
this.props.showNotification(`文件大小必须小于${size}MB!`);
} else if (file_type && forbidden_type.indexOf(file_type) !== -1) {
this.props.showNotification(`不支持${file_type}类型`);
this.props.showNotification(`仅支持文本格式,不支持图片,excel等不可以txt读取的文件`);
} else {
this.setState({
fileList: [file],
@ -91,9 +95,9 @@ class Read extends Component {
<p className="ant-upload-text">
拖动文件或<span className="color-blue">点击此处上传</span>
</p>
{/* <p className="mt10">
暂仅支持文格式不支持图片,excel等不可以txt读取的文件
</p> */}
<p className="mt10">
暂仅支持文格式不支持图片,excel等不可以txt读取的文件
</p>
<p className="mt10">
文件名请使用英文且不得超过{size}MB
</p>