|
Posted by Yohan N. Leder on 05/19/06 01:06
Hi,
Hoping it will match the alt.html group, because already tried in
comp.lang.perl.misc but it seems to be more related to browser and
multipart/form-data posting.
Well, what do you think about the pb explained in this test script
called
form2dump.pl :
#!/usr/bin/perl -w
# Script written to solve the bug explained below :
# PB : sign in any form field corrupt beginning of multipart/form-data
# in STDIN (1st lines with boundary & 1st field declar truncated)
# CAUSE : checkbox without any value (uncheckd) cause this pb
# - without <input type='checkbox' name='chk'>, it works
# - with <input type='checkbox' name='chk'> checked, it works
# NB : strange because an unchecked box shouldn't be sent !
# IDEA : I've tried to provide an hidden field with same name as
# checkbox which would submit an 'off' value when checkbox is
# unchecked, but both values are sent when checkbox is checked
# SOL : ?
print "Content-type: text/html; charset=iso-8859-1\n\n";
if ($ENV{'QUERY_STRING'} =~ /add/)
{
read STDIN, my $buff, $ENV{'CONTENT_LENGTH'};
print "<b>Multipart/form-data (ok because no binary data inside)
</b><hr>$buff";
}
else
{
print <<FORM;
<form action='/cgi-bin/form2dump.pl?add'
method='post' enctype='multipart/form-data' accept-charset='iso-8859-
1'>
<input type='text' name='txt1'><br>
<input type='text' name='txt2'><br>
<input type='text' name='txt3'><br>
<input type='text' name='txt4'><br>
<input type='text' name='txt5'><br>
<input type='submit'>
<input type='checkbox' name='chk' value='on'>
</form>
FORM
}
exit 0;
Navigation:
[Reply to this message]
|