简体   繁体   English

413请求实体太大

[英]413: Request entity too large

I am send a POST Request from some javascript with XMHTTPRequest to a python script, the python script then saves the image file that was sent in the post at base64 TEXT . 我将带有XMHTTPRequest一些javascript的POST请求发送到python脚本,然后python脚本保存在post中base64 TEXT发送的图像文件。 When I do this I am getting the error 当我这样做时,我得到了错误

POST http://example.com/save_info.py 413 (Request Entity Too Large)

However I tried sending the same thing to my friends server which we can call friend.com and it worked no issues. 但是,我尝试将相同的内容发送到我的朋友服务器,我们可以将其称为friend.com ,但没有任何问题。 So I know its not the python. 所以我知道它不是python。

And I also retrieve the saved file with a python script on example.com , and then display in HTML, this time I directly input the file that is about 1.5MB that I was trying to save earlier into mySQL and then retired it and I got no errors. 我还使用example.com上的python脚本检索了保存的文件,然后以HTML格式显示,这一次,我直接输入了大约1.5MB的文件,我试图将其更早地保存到mySQL中,然后将其淘汰了,我得到了没有错误。

So I am wondering why I am getting this error when sending the image file but not when getting it back the the database. 所以我想知道为什么在发送图像文件时却出现此错误,而在将其取回数据库时却没有。 And how can I solve this error so I can save the file? 以及如何解决此错误,以便我可以保存文件?

Thanks for the help 谢谢您的帮助

Hello if you would use NGINX you would need to set in your nginx configuration file 您好,如果您要使用NGINX,则需要在nginx配置文件中进行设置

client_max_body_size 2M;

Thus increase your limits for the file you're uploading. 因此,增加了您要上传的文件的限制。

But as long you are using shared hosting Dreamhost. 但是,只要您使用共享主机Dreamhost。 You may need to get in touch with customer help. 您可能需要与客户帮助取得联系。

However I have found that many people have been experiencing similar issue as you but with PHP, so they been customizing settings for php.ini if I am not mistaken. 但是,我发现许多人都遇到了与您类似的问题,但是使用PHP,因此,如果我没有记错的话,他们正在自定义php.ini的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM