开发者

Uploading large files but POST expires?

开发者 https://www.devze.com 2023-04-06 20:42 出处:网络
I have a form on which the user uploads a file, a video file around 500mb, it t开发者_运维知识库akes over an hour sometime(slow and paintful) but when it does upload, seems like the $_POST has expired

I have a form on which the user uploads a file, a video file around 500mb, it t开发者_运维知识库akes over an hour sometime(slow and paintful) but when it does upload, seems like the $_POST has expired? Anyone could help?

Thank you!


There are several directives you have to set up in the php.ini:

  • post_max_size
  • upload_max_filesize

and so on

EDIT: Didn't have time to finish the answer but you will need to set the memory limit and the time limit.

set_time_limit(0);
ini_set('memory_limit', -1);

These settings will make the script to run without time or memory limits.

This may fix the situation but the script becomes quite vunerable to attacks. Also any network problems will break the upload which is something that happens quite often when uploading 500mb files.


If $_POST and $_FILES are empty, most likely you exceeded the POST_MAX_SIZE allowed.


Check post_max_size in php.ini. If it's anything less than your file size, there's your problem. You can read more here:

http://php.net/manual/en/ini.core.php


You pretty much must use chunking for large uploads over the Internet. This can be possible with HTML 5 or Flash, prominent example being the YouTube uploader service.

Flash:

http://swfupload.org/

Multiple plugin support:

http://www.plupload.com/

Spiffy HTML5:

http://aquantum-demo.appspot.com/file-upload

0

精彩评论

暂无评论...
验证码 换一张
取 消