zmw 8 месяцев назад
Родитель
Сommit
2f183ad779
2 измененных файлов с 7 добавлено и 2 удалено
  1. 2 2
      app/common/api/UploadApi.php
  2. 5 0
      app/common/controller/Api.php

+ 2 - 2
app/common/api/UploadApi.php

@@ -12,8 +12,8 @@ use app\common\validate\Upload;
 class UploadApi {
 
     protected $fileSize = 5 * 1024 * 1024;
-    protected $fileExt = "jpg,png,gif,pdf,xls,xlsx";
-    protected $fileMime = "image/jpg,image/png,image/gif,application/pdf,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+    protected $fileExt = "jpg,png,gif,pdf,xls,xlsx,doc,docx,zip,7z,rar";
+    protected $fileMime = "image/jpg,image/png,image/gif,application/pdf,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/CDFV2,application/zip,application/x-rar-compressed,application/x-7z-compressed";
 
     public function __construct($config = []) {
         $this->fileSize = isset($config["maxSize"]) ? $config["maxSize"] : $this->fileSize;

+ 5 - 0
app/common/controller/Api.php

@@ -639,6 +639,11 @@ class Api extends BaseController {
                 exit();
                 break;
         }
+        if($filestd->code != 200){
+            $res = ["msg" => $filestd->msg, "obj" => $index];
+            echo sprintf("<script>parent.%s(%s);</script>", $backName, json_encode($res));
+            exit();
+        }
         $change = false;
         if ($fileId) {
             if (!$this->chkIsFileOwner($mainId, $type)) {