# How do I POST a multipart request?

**URL:** <https://rubytalk.org/t/how-do-i-post-a-multipart-request/7822>\
**Category:** ruby-talk\
**Created:** [3 September 2003 20:03 UTC](https://rubytalk.org/t/how-do-i-post-a-multipart-request/7822 "2003-09-03T20:03:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rvarghese](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@Rvarghese](https://rubytalk.org/u/Rvarghese)\
**Post date:** [3 September 2003 20:03 UTC](https://rubytalk.org/t/how-do-i-post-a-multipart-request/7822/1 "2003-09-03T20:03:36Z")

</div>

Hello

I am writing a script to send a POST request to a webserver.  
The request consists of the following:

POST /someurl/servlets/SomeServlet

Host: myname  
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US;  
rv:1.3b)  
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,_/_;q=0.1  
Accept-Encoding: none  
Accept-Charset: ISO-8859-1,utf-8;q=0.7,\*;q=0.7  
Keep-Alive: 300  
Connection: close  
Referer: [http://someserver/servlets/servlet1](http://someserver/servlets/servlet1)  
Cookie: USERID=test  
Content-Type: multipart/form-data;  
boundary=---------------------------1896019318556346621028960807  
Content-Length: 1380

-----------------------------1896019318556346621028960807  
Content-Disposition: form-data; name=“name”

Roy  
-----------------------------1896019318556346621028960807  
Content-Disposition: form-data; name=“age”

0  
-----------------------------1896019318556346621028960807  
Content-Disposition: form-data; name=“address”

12 Street  
-----------------------------1896019318556346621028960807

How can I use Ruby to send this request?  
The Net::HTTP.post method takes only the POST path and a hash of the  
headers, whereas some of the content of the request I have to send,  
cannot be hashed.

Thx  
Roy
