From: Michael Guterl Date: 2006-03-31T05:03:50+09:00 Subject: Re: WWW::Mechanize and file uploading. ------=_Part_7199_31936753.1143749025753 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline In an attempt to provide some more useful information, here's the output of mechanize. I, [2006-03-29T21:56:02.225949 #5776] INFO -- : POST: http://www.censored.com/Manager/Upload/ upload_1.asp?uploadType=3DcallList&ftp=3D0&uploadLink=3D219601&CampLink=3D5= 6458&ProjLink=3D20719&PID=3D477&OBS=3D&EBR=3D0&natlListLink=3D0 D, [2006-03-29T21:56:02.311599 #5776] DEBUG -- : query: {"rdoFileType"=3D>"= 0", "txtZipPassword"=3D>"", "selDelimiter"=3D>"Delimiter...", "txtRecLen"=3D>""= } D, [2006-03-29T21:56:02.312981 #5776] DEBUG -- : request-header: accept =3D= > */* D, [2006-03-29T21:56:02.314092 #5776] DEBUG -- : request-header: content-type =3D> application/x-www-form-urlencoded Here's the webserver's exact response. =3D> #, @cookies=3D[], @uri=3D#, @code=3D"200", @body=3D"WebServer ProcessRequest error
006~ASP 0243~Cannot use IStream on Request~Cannot use IStream on Request object after using Request.Form collection or Request.BinaryRead. ( SoftArtisans.FileUpEe.1)", @watch_for_set=3Dnil> I don't know much about what's going on behind the scenes here, but the onl= y thing apparent to me is the lack of anything related to the FileUpload in the query hash. Again, let me reiterate, I'm not sure what is going on behind the scenes, so that could be expected. I'm going to keep hacking away as soon as I get home tonight, so I'll post an update if I get anywhere. Thanks, Michael Guterl On 3/29/06, Michael Guterl wrote: > > Hello all, I am fairly new to Ruby and I am loving every minute of > it. I've > been doing a lot of reading on Ruby and I really like what I've seen thus > far. I am in the process of converting some Perl WWW::Mechanize code to > Ruby's WWW::Mechanize. Everything was going smooth until the portion > where > I have to upload a file to the website. > > Accessing page.forms[0].file_uploads[0] returns the > # @name=3D"txtUploadFile"> object. However, I cannot determine how to set = the > path to the file that I wish to upload (the value of the textbox). > > I've tried setting @file_data and @file_name to > '/Users/michaelguterl/test.txt' through the appropriate accessor method. > But each time I try and submit the form the website throws a nasty ASP > error. I know it is possible to do what I am trying to accomplish using > this approach. I'm just a little lost on the Ruby implementation of > WWW::Mechanize and trying to find anything on google is nearly impossible > with all the Perl stuff out there. > > Any help is appreciated. > > Thanks, > Michael Guterl > > ------=_Part_7199_31936753.1143749025753--