jQuery Dropzone.js - maxFilesize 增加不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17143884/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Dropzone.js - maxFilesize increase not working
提问by Ron
I'm using Dropzone.jsfor my website. I'm in the need of uploading bigger files than the default maxFilesize
of 500MB.
我在我的网站上使用Dropzone.js。我在需要上传更大的文件而不是默认的maxFilesize
的500MB。
I tried to change the number in the .js file. Now the file seems to be accepted but there is no (visible?) progress in the upload. The file has no red cross and is stuck at zero percent of the upload.
我试图更改.js 文件中的数字。现在文件似乎已被接受,但上传过程中没有(可见?)进度。该文件没有红叉,并且停留在上传的 0% 处。
Any ideas what I might be doing wrong? Or is this some kind of bug?
任何想法我可能做错了什么?或者这是某种错误?
Thanks!
谢谢!
回答by enyo
I just tested it in Chrome and it worked fine. (Which browser are you using?)
我刚刚在 Chrome 中对其进行了测试,效果很好。(你用的是哪个浏览器?)
It might be that your upload is just taking so long that you don't see an update immediately.
可能是您的上传时间太长,以至于您没有立即看到更新。
First things first: you shouldn't change properties in the .js
file itself. This way you wont be able to upgrade to a newer version of Dropzone without headaches. So configure your dropzone the way it's recommended on the website.
首先要做的是:您不应该更改.js
文件本身的属性。这样你就无法顺利升级到较新版本的 Dropzone。因此,请按照网站上推荐的方式配置您的放置区。
About the upload,... it's really hard to tell what might be wrong without a look at it. What I suggest, is that you add some kind of debugging information on the status updates, to see if it's really just your upload being very slow.
关于上传,......如果不看它真的很难说出可能有什么问题。我的建议是,您在状态更新中添加某种调试信息,以查看是否真的只是您的上传速度很慢。
Try this code and see if it doesn't solve your problem:
试试这个代码,看看它是否不能解决你的问题:
<form id="my-dropzone" action="/target" class="dropzone"></form>
<script>
Dropzone.options.myDropzone = {
maxFilesize: 500,
init: function() {
this.on("uploadprogress", function(file, progress) {
console.log("File progress", progress);
});
}
}
</script>
If you can see the console output in regular intervals then the upload is working fine but just takes a while to finish.
如果您可以定期看到控制台输出,那么上传工作正常,但需要一段时间才能完成。
回答by Wlademyr Mendes
The Dropzone.options must be out of document.ready or it wont work.
Dropzone.options 必须在 document.ready 之外,否则将无法工作。
回答by Julio Rosseti
Add to httpd.conf file:
添加到 httpd.conf 文件:
<Directory "/tmp/">
LimitRequestBody 256000
</Directory>
After, restart apache!
之后,重启apache!
Reference: https://www.cyberciti.biz/faq/apache-limiting-upload-size/
参考:https: //www.cyberciti.biz/faq/apache-limiting-upload-size/