开发者

Problems with form and POST

i am facing problems with my form, i wrote a app in Python3.1 and when i make a GET or a POST via AJAX works pefectly but when i' ve try to do the same thing with the form-way the environ['wsgi.input'] give me this:

-----------------------------4974611941277794205934495116--\r

in the first time i think this was because the file what i 开发者_开发技巧was try to upload but after i eliminate the file element and give me the same thing what means this i let you the code of the form:

<iframe id="hidden-frm" name="hidden-frm" style="display: none;">
</iframe>
<form ENCTYPE="multipart/form-data" action="Gate.py?bt=upload" method="POST" name="input" target="hidden-frm">    
    <input id="testtxt" type="text"/>
    <input type="submit" value="Presiona aqui!"/>
</form>

Thanks in advance.


That encoding is the result of the enctype="multipart/form-data, when I suspect you are actually expecting the default encoding of application/x-www-form-urlencoded (ie. key=value&key2=value2).

If you do not need the file input (which requires the multipart encoding) then simply remove the enctype from your form tag, otherwise you will need to parse the multipart input. The stdlib cgi.FieldStorage is one solution for Python 2.x, but I do not know the status of that particular class for Python 3.x (it used to be broken, IIRC).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜