PHP upload fail (empty $_FILES)

怎甘沉沦 提交于 2019-12-04 17:26:03

Instead of MB use M

memory_limit = 5100M

post_max_size = 5000M

upload_max_filesize = 5000M

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.

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.

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