开发者

Large textinput makes http post fail

开发者 https://www.devze.com 2023-04-08 23:12 出处:网络
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

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.

<form enctype="application/x-www-form-urlencoded" action="/som开发者_Go百科e/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>

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 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.

If you are cannot print errors to screen, you can check out

tail -n 30 /var/log/apache2/error.log #prints last 30 lines of error.log

immediately after your white screen symptom to get more detailed information on errors/warnings/etc encountered during the script.

Also note that 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.


what server side language you are using? maybe you need some text compression like this one Huffman Algorithm

0

精彩评论

暂无评论...
验证码 换一张
取 消