上传文件失败 Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
来源:互联网 发布:身份证识别软件app 编辑:程序博客网 时间:2024/05/17 03:15
写了一个简单的文件上传页面,但是在上传较大文件(大于20M)时,网页上传后无任何提示。
打开控制台,发现报错如下:
Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
简单来说呢,就是请求实体过大导致的错误。
我用的服务器是ngnix服务器,此时要做的就是修改配置啦。
打开nginx.conf配置文件,修改client_max_body_size值
加上下面这行:
client_max_body_size 30M(改成你想要的数值)
1.查找配置文件
find / -name nginx.conf
2.修改
vim nginx.conf
3.重新加载ngnix.conf
然后就解决啦,文件上传成功!
另外附上其他类型服务器修改配置文件的办法:
Apache服务器
修改下Apache配置文件中的LimitRequestBody配置,如果是虚拟主机,请联系空间商帮助修改。
具体步骤:
在apache环境中上传较大软件的时候,有时候会出现413错误,出现这个错误的原因,是因为apache的配置不当造成的,找到apache的配置文件目录也就是conf目录,和这个目录平行的一个目录叫conf.d打开这个conf.d,里面有一个php.conf
目录内容如下:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php4_module modules/libphp4.so
#
# Cause the PHP interpreter handle files with a .php extension.
#
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 6550000
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
错误就发生在这个LimitRequestBody配置上,将这个的值改大到超过你的软件大小就可以了
如果没有这个配置文件请将
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 6550000
写到apache的配置文件里面即可。
IIS服务器(Windows Server 2003系统IIS6)
先停止IIS Admin Service服务,然后
找到windows\system32\inesrv\下的metabase.xml,打开,找到ASPMaxRequestEntityAllowed 修改为需要的值,然后重启IIS Admin Service服务
1、在web服务扩展 允许active server pages和在服务器端的包含文档
2、修改各站点的属性 主目录-配置-选项-启用父路径
3、使之可以上传大文档(修改成您想要的大小就可以了,以字节为单位)
c:\WINDOWS\system32\inetsrv\MetaBase.xml
!企业版的windows2003在第592行
默认的预设置值 AspMaxRequestEntityAllowed="204800" 即200K
将其加两个0,即改为,现在最大就可以上传20M了。
AspMaxRequestEntityAllowed="20480000"
- 上传文件失败 Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- Failed to load resource: the server responded with a status of 400 (Bad Request)
- ajax 报错 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))
- 关于前台jsp页面Failed to load resource: the server responded with a status of 400 (Bad Request)
- 微信小程序 wx.request 出现 Failed to load resource: the server responded with a status of 400
- Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- failed to load resource the server responded with a status of 500 (internal server error)
- Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- failed to load resource the server responded with a status of 500 (internal server error)
- SharePoint Debug - Failed to load resource: the server responded with a status of 500
- Failed to load resource: the server responded with a status of 406 (Not Acceptable)
- Failed to load resource: the server responded with a status of 404
- Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
- Chronometer快速开发计时器
- mysql提示错误代码1045什么问题原因怎么办?解决方法
- Windows,Linux文件夹相关操作
- 任意切换线程的工具类
- pytho脚本通过boto3访问radosgw提供的对象存储
- 上传文件失败 Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- 蓝桥杯 波动数列
- JavaScript小项目——2048数字游戏
- 下面说说unset的用处,与为什么
- 打印沙漏
- ajax 上传文件
- 图解Android View的scrollTo(),scrollBy()
- ExpandableListView的使用和理解
- cordova之hooks