Image Uploads & Mechanize

I am trying to automate an image upload. The image appears to be
corrupted when I submit it. The documentation on the mechanize page
doesn’t seem to work properly. So I did an image upload from chrome AND
the automated mechanize application. I compared the two with Fiddler2.
The ONLY difference I see is that when I submit the image from the
mechanize application I see a header and value called
“Content-Type-Encoding: binary”. When I submit the image from within in
chrome the “Content-Type-Encoding” header is not there.

It works in Chrome
It DOES NOT work from within my automated application.

I right clicked saved as the image that was submitted from the
application so I could open it up in Notepad++. At the top of the file
image data is the…
“Content-Type-Encoding:binary” I find this interesting. I removed this
line and it fixed the image. Somehow when I submit this image from
within my automated application it somehow gets this
“Content-Type-Encoding” line put in at the top???

So, how do I say to Mechanize… when I call “form.submit”, DO NOT
INCLUDE A HEADER called “Content-Type-Encoding”. Since this is the only
difference that I see between the two.

I found where the Mechanize Gem was hard coding file uploads with a
header of Content-Type-Encoding:binary

I removed it and now images are showing up. However, it appears as
though part of my image is corrupted.