文件上传大文件 PHP/AJAX
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3562274/
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
File Upload Large Files PHP/AJAX
提问by Parampal Pooni
Im trying to find some software to help me upload really large files (>200mb). I only want to upload a single file, no multi-options. Also i would like a simple progress bar if possible.
我试图找到一些软件来帮助我上传非常大的文件(> 200mb)。我只想上传一个文件,没有多选项。如果可能的话,我也想要一个简单的进度条。
I have come across http://pixeline.be/experiments/jqUploader/which is literally what i need but it has a limit of 100mb per file, because it uses flash.
我遇到过http://pixeline.be/experiments/jqUploader/这确实是我需要的,但每个文件的限制为 100mb,因为它使用闪存。
Does anyone know of something else thats similar to this, but can handle larger files?
有谁知道与此类似的其他东西,但可以处理更大的文件?
thx
谢谢
采纳答案by JamesG
Another popular solution is http://www.swfupload.org/, but I guess it may suffer from the 100MB limit.
另一个流行的解决方案是http://www.swfupload.org/,但我想它可能会受到 100MB 的限制。
Regarding the whole issue of large file sizes, from my research it seems that in order to upload large files there is no other option than to increase the values for upload_max_filesize, post_max_size and max_execution time. I just wonder what the security implications are of having post_max_size set to, say, 500M? Its not the issue of bandwidth that concerns me - it is the possible DoS attacks that might arise from allowing attackers to send random 500M POST requests to the server. The best workaround I can think for this issue is to send uploads to a different server.
关于大文件大小的整个问题,从我的研究来看,为了上传大文件,除了增加 upload_max_filesize、post_max_size 和 max_execution 时间的值之外别无选择。我只是想知道将 post_max_size 设置为 500M 有什么安全隐患?这不是我关心的带宽问题——这是由于允许攻击者向服务器发送随机 500M POST 请求而可能引起的 DoS 攻击。对于这个问题,我能想到的最佳解决方法是将上传内容发送到不同的服务器。
There is a good discussion of the whole issue here:
这里对整个问题进行了很好的讨论:
http://aaronwinborn.com/blogs/aaron/how-handle-large-file-uploads
http://aaronwinborn.com/blogs/aaron/how-handle-large-file-uploads
If any Apache hackers out there can shed any light on the security implications of having a really large value for post_max_size that would be great.
如果有任何 Apache 黑客可以阐明对 post_max_size 具有非常大的值的安全影响,那将会很棒。
回答by SlasherZ
You can try using HTML5 and AJAX to handle large file uploads. In a combination with PHP streams you'll get very low memory usage. Here a link with more details:
您可以尝试使用 HTML5 和 AJAX 来处理大文件上传。与 PHP 流相结合,您将获得非常低的内存使用量。这是包含更多详细信息的链接:
http://www.webiny.com/blog/2012/05/07/webiny-file-upload-with-html5-and-ajax-using-php-streams/
http://www.webiny.com/blog/2012/05/07/webiny-file-upload-with-html5-and-ajax-using-php-streams/
回答by Shahriyar Imanov
I would recommend implementing a Java uploader, like JumpLoaderand integrate it with your current system. It has extensive API and its JScript interface is easily accessibly as well. You can, as I did, code your server side handler and make it capable of:
我建议实现一个 Java 上传器,如JumpLoader,并将其与您当前的系统集成。它具有广泛的 API 并且它的 JScript 接口也很容易访问。您可以像我一样对服务器端处理程序进行编码并使其能够:
- Multiple file uploading
- Uploads without any limits in filesize - I am currently struggling with PHP's 2G limit on fopen(), but I expect to solve soon
- Partitioned uploading - file gets uploaded in chunks
- Transmission integrity - JumpLoader can also calculate and send md5 checksums for every partition and the whole file itself, which you can validate in server side to see whether the package arrived ok or not.
- 多文件上传
- 上传文件大小没有任何限制 - 我目前正在努力解决 PHP 对 fopen() 的 2G 限制,但我希望很快解决
- 分区上传 - 文件分块上传
- 传输完整性 - JumpLoader 还可以为每个分区和整个文件本身计算和发送 md5 校验和,您可以在服务器端验证以查看包是否正确到达。
Hope it helps.
希望能帮助到你。