浏览代码

up-A1项目成功上传格式改成只支持zip

shaogen1995 1 年之前
父节点
当前提交
177921735f
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      src/components/Z3upFiles/index.tsx

+ 9 - 1
src/components/Z3upFiles/index.tsx

@@ -46,6 +46,13 @@ function Z3upFiles(
       if (e.target.files) {
         // 拿到files信息
         const filesInfo = e.target.files[0];
+
+        // 校验格式
+        if (!filesInfo.name.includes(".zip")) {
+          e.target.value = "";
+          return MessageFu.warning(`只支持zip格式!`);
+        }
+
         // 创建FormData对象
         const fd = new FormData();
         // 把files添加进FormData对象(‘photo’为后端需要的字段)
@@ -104,6 +111,7 @@ function Z3upFiles(
       <input
         id="upInput"
         type="file"
+        accept='.zip'
         ref={myInput}
         onChange={(e) => handeUpPhoto(e)}
       />
@@ -159,7 +167,7 @@ function Z3upFiles(
         </div>
 
         <div className="fileTit" hidden={isLook}>
-          此处的附件为对外的项目成果文件,如程序安装包等,最多支持10个
+          此处的附件为对外的项目成果文件,仅支持zip格式,最多10个
           <br />
           <div
             className={classNames(