大的textinput使http post失败 [英] Large textinput makes http post fail
问题描述
我在我的应用程序中有一个表单,技术人员输入有关不同事件或采取的操作的信息(如更新服务器)。问题是这些输入可能相当长,然后我的表单停止工作。如果浏览器尝试发送数据,服务器会向浏览器返回302错误,但正如我经常尝试提交时浏览器无法执行任何操作一样。如果浏览器没有做任何事情,Chrome开发者工具快速浏览显示浏览器试图执行一个帖子到正确的路径,但状态列为失败。如果textarea包含超过3500个字符,就会发生这种情况。
< form enctype = application / x-www-form-urlencodedaction =/ some / path /method =post_lpchecked =1>
< fieldset>
< input type =hiddenname =machineIdvalue =some_integer>
< input type =hiddenname =eventIdvalue =some_integer>
标题:
< select name =form [title]>
< option> Some_option< / option>
< option> some_option< / option>
< / select>
< input type =submitvalue =Sparatitle =Spara>
< / fieldset>
< / form>
关于为什么它不起作用以及可以做什么的任何想法
编辑:
我的应用程序基于PHP并运行在Debian / Apache上。我无法找到任何可能阻止帖子正常工作的设置。我有一个post_max_size设置为8MB,但3500字符的文本不大于8MB,所以...
通过 如果你不能在屏幕上打印错误,你可以退房 另请注意, 在您的白屏幕症状后立即获取有关错误/警告/ / code>被 I have a form in my application where technicians input information about different events or actions taken (like updating a server). The problem is that these inputs can be quite lengthy and then my form stops working. The server returns a 302 error to the browser if the browsers tries to send data, but just as often the browser does nothing when I try to submit. When the browser does nothing a quick look in the Chrome Developer Tools shows that the browser tries to execute a post to the correct path, but the status is listed as failed. This always occurs if the textarea contains more than ~3500 characters. I've tried to change the enctype to see what happens but it hasn't solved the problem. Any ideas on why it doesn't work and what can be done? EDIT:
My application is based on PHP and running on Debian/Apache. I haven't been able to find any settings that might prevent the post from working correctly. I do have a post_max_size set at 8MB, but a text of 3500 chars are not larger than 8MB so... Your text via If you are cannot print errors to screen, you can check out immediately after your white screen symptom to get more detailed information on errors/warnings/etc encountered during the script. Also note that 这篇关于大的textinput使http post失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! POST
的文本很可能不会是1字节/字符。 Apache mod_security可能正在过滤数据。它可以是任何影响后加密的其他数量的Apache mod。您可以查看 mb_get_info()和其他mb_ *函数以验证PHP如何编码文本。如果你不想深入挖掘,你可以从一些数据点猜测你的POST中每个字符有多少字节,并调整 post_max_size $ c
tail -n 30 /var/log/apache2/error.log #prints过去30行error.log
< p $> b
$ b post_max_size
memory_limit
限制......我认为这不是问题,但它可能是另一位读者想要考虑的问题。<form enctype="application/x-www-form-urlencoded" action="/some/path/" method="post" _lpchecked="1">
<fieldset>
<input type="hidden" name="machineId" value="some_integer">
<input type="hidden" name="eventId" value="some_integer">
Titel:
<select name="form[title]">
<option>Some_option</option>
<option>some_option</option>
</select>
<textarea name="form[text]" rows="25" cols="90"></textarea>
<input type="submit" value="Spara" title="Spara">
</fieldset>
</form>
POST
will most likely NOT be 1 byte/character. Apache mod_security might be filtering the data. And it could be any other number of Apache mods that affect post encryption. You might check out mb_get_info() and other mb_* functions to verify how PHP is encoding the text. If you don't want to have to dig too deeply, you can make an educated guess from a couple data points as to how many bytes per character are being used in your POST and adjust post_max_size
to suit your needs.tail -n 30 /var/log/apache2/error.log #prints last 30 lines of error.log
post_max_size
is limited by memory_limit
... I don't think that is the issue, but it may be something to consider for another reader.