大文件上传-请求被取消 [英] Large file upload - Request gets cancelled

查看:178
本文介绍了大文件上传-请求被取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试上传40-50mb大小的视频文件。如果我在Google Chrome浏览器的网络标签中观察到,进度条将在某个时间点冻结​​。请求被取消,并且没有错误并且HTTP响应标头为空。



但是,这对于大约10-15mb的图像/视频文件都有效。 / p>

我的代码:

  Dropzone.autoDiscover = false; 
var myDropzone = new Dropzone(#my-awesome-dropzone,{
maxFiles:1,
parallelUploads:100,
acceptFiles:'.3gp,.3gp2 ,. h261,.h263,.h264,.jpgv,.jpm,.jpgm,.mp4,.mp4v,.mpg4,.mpeg,.mpg,.mpe,.m1v,.m2v,.ogv,.qt,.mov, .fli,.flv,.mks,.mkv,.wmv,.avi,.movi​​e,.smv,.g3,.jpeg,.jpg,.jpe,.png,.btif,.sgi,.svg,.tiff ,.tif',
PreviewTemplate:previewTemplate,
Previews容器:#previews,
autoProcessQueue:false,
clickable:。fileinput-button,
} );

PS:这不是服务器端的问题,因为我尝试在没有Dropzone的情况下进行上传,并且一切运行正常。

解决方案

您是否使用了dropzone.js版本> = 4.4.0和ajax请求?



如果是这样,则必须在配置中设置超时(以毫秒为单位)。它为xhr(ajax)请求指定超时值,默认值仅为30s。



来源: http://www.dropzonejs.com/#configuration


I am trying to upload video files of size 40-50mb. The progress bar freezes at a certain point and if i observe in my Networks tab on Google Chrome. The request gets cancelled and there is no error and the HTTP response header is empty.

However this is working for both image/video files which are around 10-15mb.

My code:

Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("#my-awesome-dropzone", {
        maxFiles: 1,
        parallelUploads: 100,
        acceptedFiles: '.3gp,.3gp2,.h261,.h263,.h264,.jpgv,.jpm,.jpgm,.mp4,.mp4v,.mpg4,.mpeg,.mpg,.mpe,.m1v,.m2v,.ogv,.qt,.mov,.fli,.flv,.mks,.mkv,.wmv,.avi,.movie,.smv,.g3,.jpeg,.jpg,.jpe,.png,.btif,.sgi,.svg,.tiff,.tif',
        previewTemplate: previewTemplate,
        previewsContainer: "#previews",
        autoProcessQueue: false,
        clickable: ".fileinput-button",
    });

P.S: It is not a server side issue as i have tried uploading without Dropzone and everything works smoothly.

解决方案

Did you use dropzone.js version >= 4.4.0 and ajax request?

If so, you must set the timeout (in ms) in your configuration. It's specify timeout value for xhr (ajax) request, and default value only 30s.

Source: http://www.dropzonejs.com/#configuration

这篇关于大文件上传-请求被取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆