Forum: Ruby on Rails Upload File Using Net::HTTP to ROR App.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
billbell52 (Guest)
on 2007-05-19 01:04
(Received via mailing list)
I can submit a zip file using a form to an ROR application.  But I
need to be able to do this with a program so I am planning on using
Net::HTTP.  I am debugging it on a PC using Webrick.  I create a
multipart file (shown below).  I use the following command to send the

response = Net::HTTP.start("localhost", 3000).post("/upload/upload",
query, "Content-type" => "multipart/form-data; boundary=" + boundary +
" " )

There is a controller called app/controllers/upload_controller.rb.
There is method in the controller called upload.

For some reason the server cannot find /upload/upload.  Here is a
truncated error log.  I have tried everything I know to try.  Any
ideas on this.

#<TypeError: can't dup NilClass>
["c:/ruby185/lib/ruby/1.8/cgi.rb:1057:in `dup'", "c:.....

[2007-05-18 15:54:40] ERROR `/upload/upload' not found. - - [18/May/2007:15:54:40 Central Standard Time] "POST /
HTTP/1.1" 404 283
- -> /upload/upload

query is the info below.  I tried various mime_types like application/
zip etc.

Content-Disposition: form-data;name="commit"

Upload file
Content-Disposition: form-data;name="entry%5Buser_name%5D"

Content-Disposition: form-data;name="entry%5Bip_address%5D"
Content-Disposition: form-data; name="entry%5Bzip
Content-Transfer-Encoding: binary

PK    DQ°6zz֞Š        test.yamlåTMoÛ0½ÈàzO ·Hšh—¥Ãvêi(0E!
ÀuÄ&¿À"iÕ¹¨Y»J(ùH¥Dmä=‡è;Ì
£ñØRØõÞýM©wâ  }ÐÎN…f‡b„¨]™¬Q«ßQ>t­Óéãà4ºWQI>9™‡CrdÉÅŒ£
(Ñp¨œ;œœ­z*FS?†< ¿ǯš¶ÛŒT®É£®µ'æÔ•lê¬~ìðíî¼³4ý²w-MÀé­
—„žÒÿä'PK     DQ
°6zz֞Š               ¶    test.yamlPK      7
This topic is locked and can not be replied to.