F
Francis Hwang
I suppose it's possible that I'm the only Ruby programmer ever to run
into this problem, but I'm having an obscure problem with the CGI
library. Maybe it's a bug or maybe I'm just missing something.
I'm using a multipart form with images for buttons and trying to
detect which image was used to submit. With a form like this:
<form action="/test/upload.rb" method="post"
enctype="multipart/form-data">
<input name="text" />
<br />Small: <input type="file" name="small" />
<br /><input type="image" src="/baseims/submit_button.gif"
name="button" />
</form>
I should get values for either "button" or "button.x" and "button.y",
or both. Depending on the browser. Here's what my /test/upload.rb
looks like:
puts "Content-type: text/html\n\n"
cgi = CGI.new
puts "<br />text: #{ cgi['text'].readlines.join( "\n" ) }"
puts "<br />button.x: #{ cgi['button.x'].readlines.join( "\n" ) }"
puts "<br />button.y: #{ cgi['button.y'].readlines.join( "\n" ) }"
puts "<br />button: #{ cgi['button'].readlines.join( "\n" ) }"
When I do this in Safari, it's fine. But when I do this in MSIE OS X,
I get nothing for any of the button values.
At first I thought this might be a MSIE problem, but I did the exact
same thing with PHP and it works fine in both Safari and MSIE. So
maybe I'm doing something really wrong, or maybe I've hit an obscure
bug? Advice would be much appreciated.
Francis
into this problem, but I'm having an obscure problem with the CGI
library. Maybe it's a bug or maybe I'm just missing something.
I'm using a multipart form with images for buttons and trying to
detect which image was used to submit. With a form like this:
<form action="/test/upload.rb" method="post"
enctype="multipart/form-data">
<input name="text" />
<br />Small: <input type="file" name="small" />
<br /><input type="image" src="/baseims/submit_button.gif"
name="button" />
</form>
I should get values for either "button" or "button.x" and "button.y",
or both. Depending on the browser. Here's what my /test/upload.rb
looks like:
puts "Content-type: text/html\n\n"
cgi = CGI.new
puts "<br />text: #{ cgi['text'].readlines.join( "\n" ) }"
puts "<br />button.x: #{ cgi['button.x'].readlines.join( "\n" ) }"
puts "<br />button.y: #{ cgi['button.y'].readlines.join( "\n" ) }"
puts "<br />button: #{ cgi['button'].readlines.join( "\n" ) }"
When I do this in Safari, it's fine. But when I do this in MSIE OS X,
I get nothing for any of the button values.
At first I thought this might be a MSIE problem, but I did the exact
same thing with PHP and it works fine in both Safari and MSIE. So
maybe I'm doing something really wrong, or maybe I've hit an obscure
bug? Advice would be much appreciated.
Francis