Record once springboot + vue + axios be a problem (the front + back-end) large file upload failed

The first step: Modify springboot multipart configuration

spring:
  servlet:
     multipart: 
        max-file-size: 5000MB
        max-request-size: 5000MB

Step two: Modify the tomcat server connection time (or springboot profile)

server:
 connection-timeout: 18000000

 

Front-end is still being given: given as follows

 

 

Third step: Increase the distal VUE send asynchronous request time of axios

customRequest (data) {// upload submit 
        the this. $ the Message a .success ( " File Uploading! " ); 
          const formData = new new FormData (); 
          formData.append ( 'File', data.file); 
          console.log ( " Data " + Data); 
          formData.append ( 'token', " token " ) 
          this.axios ({ 
           Method: 'POST', 
           timeout: 900000, // this is the point 
           URL: ' / HDFS / the saveFile', 
           headers: { 
           }, 
           params:{
           },
           data: formData
         }).then((response) => {
             console.log(response) 
             data.onSuccess();
           }).catch(function (error) {
             data.onError();
             console.log(error)
           })
         },

to sum up:

Server-side and front-end should consider the issue of overtime

VUE axios will send an asynchronous request if the acquisition in return for less than the default result, axios the connection is interrupted, causing the rear end of the back-end file fails to accept the errors reported io.eof

Guess you like

Origin www.cnblogs.com/erlou96/p/12403595.html