PHP: Uploading large files fail

牧云@^-^@ 提交于 2020-02-12 02:53:29

问题


Im confused... I can't seem to upload files in the 2gb range. When i try using curl to send a 1.92gb file to my site (through an API), it doesn't report anything at all, its just blank. When i send a 1kb file, it reports back like it should.

When i try uploading via the upload form, it ends up freezing mid way, around 33%. Although im not sure if only the progress bar has froze or if the actual file upload it self has been suspended. I suspect that only the progress bar has froze because it still says data is being sent even though the progress bar freezes.

My php.ini (yes, its reflected by phpinfo as well):

register_globals = Off
magic_quotes_gpc = Off
post_max_size = 2047M
upload_max_filesize = 2047M
max_execution_time = 25200     ; Maximum execution time of each script, in seconds
max_input_time = 25200  ; Maximum amount of time each script may spend parsing request data
memory_limit = 2048M      ; Maximum amount of memory a script may consume (16MB)
short_open_tag = On 

My vps doesnt actually have 2gb of ram at its disposal, but does memory_limit really need to be set this high?

How should i go about testing this? I know 400mb files work, i haven't tested anything in between 400mb and 1.92gb

You will need a premium account to test up to 2gb, so here is one you can play with:

User: testreferral

Pass: 1234

http://filefx.com

I dont understand where this problem is arising.


回答1:


Check for:

  1. Memory limit. Try uploading files above and below the actual memory limit.
  2. Time limit. Aren't your uploads take 7+ hours, are they?
  3. The effective settings. Some setting might be overridden by server/etc settings.



回答2:


PHP: mysql query skipped/ignored after large file uploads?

Mysql was timing out during the file upload. So the file wasn't showing up in the DB



来源:https://stackoverflow.com/questions/4083100/php-uploading-large-files-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!