Mechanize Form File Upload

Hi all,

I'm trying to upload a file to a Form in this way. My Question is, how
to get the imagefile posted correctly.

def uploadpicture(username, password, imagepath)
  agent = Mechanize.new
  agent.post("http://www.somesite.com/",
              { 'function' => 'picture2',
                'username' => username,
                'password' => password,
                'pict' => ???,
                'pict_to' => 0,
                'pict_type' => 0,
                'submit' => 'Send' }) { |page| return page }
end

Thanks and Regards,

T.

···

--
Posted via http://www.ruby-forum.com/.

                'pict' => ???,

File.binread('pic.jpg') ?

···

--
Posted via http://www.ruby-forum.com/\.