开发者

PHP upload fail (empty $_FILES)

I have a common problem in PHP : My $_FILES array is empty when files are too big.

php.ini :

max_execution_time = 300000
max_input_time = 600000000
memory_limit = 5100MB
post_max_size = 5000MB
upload_max_filesize = 5000MB

The file :

Trouve.tar : 910Mo

Configuration values are huge but I want to be sure that the script have the time and the memory to do the upload.

So, the authorized size is bigger than the file size, but I have the same error than other peopl开发者_运维百科e (like problem with uploading the images with php file upload for exemple)

Have I missed some configuration setting ?


The problem is your post_max_size is the same size as upload_max_filesize which will cause the $_FILES array (and $_POST) to be empty. If you up the limit on the post_max_size, the $_FILES array will no longer be empty.

EDIT: Not sure why the negative vote. While it may not apply exactly in this case, it is worth mentioning. This is exactly what php.net says: http://www.php.net/manual/en/ini.core.php#ini.post-max-size.

If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty.


Instead of MB use M

memory_limit = 5100M

post_max_size = 5000M

upload_max_filesize = 5000M


Check your upload_limit in your php.ini settings.

In your html form tag, do not forget to put this: enctype="multipart/form-data"


Check you web server limits in addition to the php.ini configuration.

For example, you'll probably have to increase the LimitRequestBody if you're using Apache or the client_max_body_size if you're using nginx.

When an HTTP request is larger that the limit accepted by the web server, it returns an HTTP response with status: 413 Request Entity Too Large.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜