如何在PHP中上传500MB以上的大文件 [英] How to upload large files above 500MB in PHP
问题描述
我用PHP创建了一个上传页面,但是我不知道为什么该页面不能上传大于500MB的文档,这是我第一次尝试上传较大的内容,因此我更改了PHP.INI中的所有配置( post_max_size = 700M,upload_max_filesize = 600M,max_execution_time = 300).上传代码如下
I made an upload page in PHP, but I dont know why the page would not upload documents greater than 500MB, This is my first time of trying to upload something that large, I changed all the configurations in the PHP.INI (post_max_size = 700M, upload_max_filesize = 600M, and max_execution_time = 300). The codes for upload is as below
if(isset($_FILES['upload']) && !empty($_FILES['upload']['name'])){
move_uploaded_file($_FILES['upload']['tmp_name'], $this->filePath.$this->fileName);
}
我需要帮助,我想知道是否有些事情做对了.
I need help, I wonder if there is something am not doing right..
推荐答案
您认为增加上传大小限制是否可以解决问题?如果上传2GB的文件怎么办?您是否考虑过此类脚本的内存使用情况?
Do you think if increasing upload size limit will solve the problem? what if uploading 2GB file, what's happening then? Do you take into consideration the memory usage of such a script?
相反,您需要的是分块上传,请参见此处:处理plupload在服务器端的分块上传 并且在这里:文件上传;如何利用分块"?
Instead, what you need is chunked upload, see here : Handling plupload's chunked uploads on the server-side and here : File uploads; How to utilize "chunking"?
这篇关于如何在PHP中上传500MB以上的大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!