Why Javascript upload chunk sizes change by browser?

后端 未结 1 1425
余生分开走
余生分开走 2021-01-19 01:20

I am uploading files by javascript code to server. I noticed that different browsers are sending bytes of different sizes. As you can see in the following pictures, Internet

相关标签:
1条回答
  • 2021-01-19 02:07

    I don't know why it's different, but you can alter your behavior based on the browser (as opposed to standardizing as you asked in the question).

    Refer to the code in the moo uploader as an example.

    From: https://github.com/juanparati/MooUpload/blob/master/Source/MooUpload.js

        // Get slice method
        if (file.mozSlice)          // Mozilla based
          chunk = file.mozSlice(start, total)
        else if (file.webkitSlice)  // Chrome, Safari, Konqueror and webkit based
          chunk = file.webkitSlice(start, total);
        else                        // Opera and other standards browsers
          chunk = file.slice(start, total)
    
    0 讨论(0)
提交回复
热议问题