The image uploaded by formdata reported an error when the image size was too large on iphone6.

the picture is compressed with canvas and uploaded with formdata

$.ajax ({

)
      url:"/apis/rest/file/v2.0/image",
      headers:{
        "Authorization":_self.$router.access_token
      },
      type:"post",
      dataType:"json",
      contentType:false,
      processData:false,
      data:formdata,
    }).done(function(data){
      console.log(data)

})

The

code is similar to the
picture size limit above. 2MB canvas.toDataURL compression is 0.5
iphone6. Safari uploading pictures will cause
readyState:0
status:0
but iPhoneX is fine

.

if you change the canvas.toDataURL compression to 0.1 iPhone6, you can upload it successfully

what is the reason?

Apr.06,2022

the reason is that the memory explodes due to the large picture.
it is recommended not to compress too many pictures at a time. Limit the width and height
I am using a third-party tool lrz compressed

.
Menu