为什么Javascript通过浏览器上传块大小? [英] Why Javascript upload chunk sizes change by browser?
问题描述
- XMLHttpRequest的。我可以为所有浏览器设置标准的
上传字节吗?因为不同大小的流量在某些浏览器上给出
错误。 Http error is 404.13。
- 我将web.config文件配置为
< requestLimits maxAllowedContentLength =1073741824>
(1GB)当我用Firefox和Chrome上传一个大文件(500 Mb)时,服务器发出system.OutOfMemoryException异常。 Internet Explorer工作正常。
Firefox Internet Explorer Chrome stack.imgur.com/Tcw6F.pngalt =在这里输入图片描述> 我不知道为什么这是不同的,但是你可以改变你的行为基于浏览器(而不是像你问的问题标准化)。 请参阅moo uploader中的代码为一个例子。 发件人: https://github.com/juanparati/MooUpload/blob/master/Source/MooUpload.js 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 Explorer is sending small bytes but Chrome and Firefox send bigger bytes. Firefox Internet Explorer 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. From: https://github.com/juanparati/MooUpload/blob/master/Source/MooUpload.js
这篇关于为什么Javascript通过浏览器上传块大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
//获取sli ce方法
if(file.mozSlice)//基于Mozilla的
chunk = file.mozSlice(开始,总计)
else if(file.webkitSlice)// Chrome,Safari,Konqueror和webkit基于
chunk = file.webkitSlice(start,total);
else // Opera和其他标准浏览器
chunk = file.slice(开始,总计)
<requestLimits maxAllowedContentLength="1073741824">
(1GB) but when I upload a big file(500 Mb) with Firefox and Chrome, the server is giving system.OutOfMemoryException. Internet Explorer is working fine. // 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)