2012-07-26 170 views
1

当我张贴的base64字符串超过1.2 MB的Apache Tomcat给予错误:“客户端发送的请求是语法不正确” 当它是根据1.2 MB它工作得很好,我在服务器端接收数据。jQuery的阿贾克斯后

是否有尺寸限制,我该如何解决这个问题?任何帮助将不胜感激。

感谢很多:)

$.ajax({ type: 'POST', 
     url: 'http://localhost/testServer/image', 
     data: {imageData : result} , 
     async: true, 
     success: function(data) { 

     }, 
     error: function (xhr, textStatus, errorThrown) { 
      alert(xhr.responseText); 
     } 
    }); 

回答

2

HTTP规范没有规定具体的大小限制的职位。它们通常会受到Web服务器或用于处理提交的编程技术的限制。


In httpd.conf add this line

LimitRequestBody<filesize>

LimitRequestBody Directive specifies the number of bytes from 0 (meaning unlimited) to >2147483647 (2GB) that are allowed in a request body

For more information,please refer the URL:

http://httpd.apache.org/docs/mod/core.html#limitrequestbody

Source: here

+0

是的,这就是我说的“tomcat的给出了错误:‘客户端发送的请求是语法不正确的’感谢 – Pinchy 2012-07-26 00:09:45

+0

见我的编辑,看看它是否会有所帮助! :) – silentw 2012-07-26 00:16:00

+1

好的谢谢:)它帮助,但这是为httpd服务器。我所做的是将maxPostSize =“0”添加到server.xml文件中的连接器解决它。谢谢 – Pinchy 2012-07-26 00:18:01