Ajax uploads files asynchronously. Background springcloud, large file exception

1,-sharp-sharp-sharp problem description
failed to upload large file (test 1.3g), picture can be uploaded successfully

clipboard.png

/zuul

clipboard.png

related codes

/ / Please paste the code text below (do not replace the code with pictures)
zuul gateway configuration

zuul:
  routes:
    service-video:
      path: /video/**
      sensitiveHeaders: 
      service-id: service-video
  sensitiveHeaders:
 
    @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
    @HystrixCommand(fallbackMethod="uploadFallback")
    public String uploadFile(@RequestParam("uploadfile") MultipartFile uploadFile,HttpServletRequest request) throws IOException {
        JSONObject response = new JSONObject();
        
        String attachName = request.getParameter("attachName");
        String tag = request.getParameter("tag");//
        String path = "img";
        
        InputStream stream = uploadFile.getInputStream();
        
        if(StringUtils.isNotEmpty(tag)) {
            path = tag;
        }
        
        attachName = "[" + CommonUtil.getDataFormat(new Date(), "yyyyMMddHHmmssSSS") + "]" + attachName;
        
        UploadFile ftp = new UploadFile();
        boolean flag = ftp.UploadFileToServer(stream,attachName, path);
        
        response.put("success", flag);
        response.put("uploadFileName", attachName);
        
        return response.toString();
    }

Front end call

    $.ajax({
                    url: server + "/zuul/video/uploadFile",
                    data: formFile,
                    type: "Post",
                    dataType: "json",
                    cache: false, //
                    processData: false, //data false
                    contentType: false, //
                    xhr: function () {
                        var myXhr = $.ajaxSettings.xhr();
                        if (myXhr.upload) {
                            myXhr.upload.addEventListener("progress", function (e) {
                                console.log("in Download progress");
                                if (e.lengthComputable) {
                                    var percentComplete = Math.round((e.loaded / e.total) * 100);
                                    console.log(percentComplete);
                                    $("-sharpvideo-progress-width").css("width", percentComplete + "%");
                                } else {
                                    console.log("Length not computable.");
                                }
                            }, false);
                        }
                        return myXhr;
                    },
                    beforeSend: function () {
                        $("-sharpvideo-progress").show();
                    },
                    complete: function () {
                        $("-sharpvideo-progress").hide();
                    },
                    success: function (result) {
                        $("-sharpchooceVideo").removeAttr("disabled");
                        $("-sharpchooceVideo").val("");
                        if (result.success) {
                            that.uploadVideoFileshow = true;
                            $("-sharpuploadVideoPath").val(result.uploadFileName);
                        } else {
                            layer.alert("!");
                        }
                    },
                    error: function () {
                        $("-sharpvideo-progress").hide();
                        $("-sharpchooceVideo").removeAttr("disabled");
                        $("-sharpchooceVideo").val("");
                        layer.alert("!");
                    }
                })

what result do you expect? What is the error message actually seen?

File uploaded successfully. Small files can be uploaded

May.02,2021

this may be the limitation of springboot. Is max-file-size? configured?


upload after slicing, so that you can skip the limit and display the progress bar
.
Menu