[英]Why Javascript upload chunk sizes change by browser?
I am uploading files by javascript code to server. 我正在通过javascript代码将文件上传到服务器。 I noticed that different browsers are sending bytes of different sizes.
我注意到不同的浏览器正在发送不同大小的字节。 As you can see in the following pictures, Internet Explorer is sending small bytes but Chrome and Firefox send bigger bytes.
正如您在下面的图片中看到的那样,Internet Explorer发送的是小字节,但Chrome和Firefox会发送更大的字节。
<requestLimits maxAllowedContentLength="1073741824">
(1GB) but when I upload a big file(500 Mb) with Firefox and Chrome, the server is giving system.OutOfMemoryException. <requestLimits maxAllowedContentLength="1073741824">
(1GB),但是当我使用Firefox和Chrome上传大文件(500 Mb)时,服务器正在提供system.OutOfMemoryException。 Internet Explorer is working fine. Firefox 火狐
Internet Explorer IE浏览器
Chrome 铬
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. 请参阅moo上传器中的代码作为示例。
From: https://github.com/juanparati/MooUpload/blob/master/Source/MooUpload.js 来自: 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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.