Php 图像文件上传,但在 Web 服务中发布图像基础 64 字符串时给出错误 413


Php image file upload, but while post image base 64 string post in webservice give an error 413

>我通过文件上传控件上传了 4 MB 的图像,它上传了。我想通过网络服务发布数据,因为我获得了 base64 字符串形式的图像数据。我的代码在暂存方面工作得很好,但是在实时服务器上,我尝试运行脚本时它不起作用。图像是 768x80 像素的图像,大小为 188 kb 的 png 格式,然后返回以下错误:

 Request Entity Too Large
 The requested resource /web/index.php/webservices/uploadpicture
 does not allow request data with POST requests, or the amount of data provided in
 the request exceeds the capacity limit.
 Apache Server at www.mysite.com Port 80

托管服务器是干爹。我们无权修改 apache 和 php.ini 的配置。我尝试通过.htaccess修改配置。使用以下设置创建php.ini

max_execution_time=3600,max_input_time = 9999,post_max_size = 64M,upload_max_filesize = 64M

还尝试使用以下设置修改.htaccess中的mod_security.c模块:

SecRuleEngine Off, SecRequestBodyAccess Off
My php.ini settings of file size is following.
Directive   Local Value Master Value
max_file_uploads    20  20
max_input_time          60  60
memory_limit            64M 64M
post_max_size           33M 33M
upload_max_filesize 32M 32M

我已经尝试了所有方法,但仍然无法解决我的问题。

也许您可以将该base64图像字符串打包到较小的图像字符串中并发送该图像字符串?

还要检查ISP是否没有限制apache配置LimitRequestBody

在此处阅读更多内容: http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestbody