导入 Excel 文件时,抛出 413 (Request Entity Too Large) 错误
Excel文件大小:8MB
异常信息:413 (Request Entity Too Large)
环境:IIS10+PHP7.2.33
依次检查如下几项:
一、php.ini
Maximum amount of memory a script may consume (128MB)
限制代码消耗的最大内存,默认128MB。
memory_limit = 1024M
Maximum allowed size for uploaded files. default 200M
允许文件上传大小
upload_max_filesize = 512M,默认200M。
Maximum size of POST data that PHP will accept.
Its value may be 0 to disable the limit. It is ignored if POST data reading
is disabled through enable_post_data_reading.
向服务器提交的最大数据大小
post_max_size = 1024M
二、web.config
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="536870912"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
536870912 Byte 字节 = 512MB 兆字节