Failed to upload image on mobile

Environment : The problem feedback in the app can upload up to 4 pictures
. Upload method : picture base64
problem : uploading 1 picture without problems, uploading multiple pictures will
cause upload failure Reason : After a single picture is converted to base64, the request body size does not exceed The client tomcat request body size is limited to 2M (default). When uploading multiple copies, an error will occur. The error in postman is as follows
Insert picture description here

Solution :

  • Method 0: Upload the pictures separately, one at a time, but the symptoms are not a cure. If a single picture is too large, the problem will also occur. This method is pass
  • Method 1: In the case that the front-end does not change the uploading image mode (base64), the back-end appropriately increases the size limit of the post request body content
  • Method 2: Modify the front-end and back-end interface, change base64 upload to file upload, and set the size of a single attachment or the total size of a request at a time on the back-end

Only this record, please correct me if you have any questions!

Guess you like

Origin blog.csdn.net/nongminkouhao/article/details/107841130