【问题标题】:POST requests, or the amount of data provided in the request exceeds the capacity limitPOST请求,或者请求中提供的数据量超过容量限制
【发布时间】:2018-03-19 00:31:22
【问题描述】:

当我尝试将 excel 文件上传到数据库时,我在 000webhost 上遇到了这个问题。

这是我的测试站点的链接Test site for Excel Sheets

有一个文件名为largedata.xlsx 我正在尝试上传这个文件。 Here

这需要一些时间,但在此之后它会显示错误消息POST requests, or the amount of data provided in the request exceeds the capacity limit.

我对此进行了搜索,并且已经更新了.htaccess 文件中的post_max_sizeupload_max_filesize,您可以查看info.php 了解此详细信息。但我仍然面临这个问题。

.htaccess

php_value post_max_size xxM
php_value upload_max_filesize xxM

用你的值替换 xx

【问题讨论】:

  • 那你想让我们做什么?如果数据超过限制,出于安全原因,进程将被终止。
  • 关于那个动态配置文件(“.htaccess”样式文件)...你确定它被考虑了吗?您需要首先在主机配置中启用它的解释。查看文档中的 AllowOverride 指令。
  • 我想问我的代码有什么问题还是来自托管服务提供商???
  • 显然我们无法对您的帖子发表任何评论,因为我们不知道。但我根本不会认为这是一个真正的问题,对我来说,这看起来像该系统按预期工作。
  • 你在使用 PHP-FPM 吗?

标签: php excel .htaccess php-ini


【解决方案1】:

当请求正文大于服务器配置允许的大小时,会发生 413 错误。以下是修复它的方法,具体取决于您的网络服务器:

Apache: Set the LimitRequestBody directive in either your httpd.conf file or a local .htaccess file. (https://stackoverflow.com/a/3719358/1688568)

Nginx: Set the client_max_body_size directive in nginx.conf (http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/)

IIS: Set the uploadreadaheadsize config setting (http://blogs.msdn.com/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx)

【讨论】:

    猜你喜欢
    • 2016-11-19
    • 2021-09-21
    • 2018-05-03
    • 1970-01-01
    • 2018-02-14
    • 1970-01-01
    • 2022-10-05
    • 1970-01-01
    • 2015-11-12
    相关资源
    最近更新 更多