Topic: How to post xml files to another server?

I am about to do an app that is going to post xml files to another server. I have read the standard library documentation and found the net/http.rb with class net::HTTP to post form data to another server.

Example:

#1: Simple POST
    res = Net::HTTP.post_form(URI.parse('http://www.example.com/search.cgi'),
                              {'q'=>'ruby', 'max'=>'50'})

But I have not found anny method for posting a file to another server. Is there annyone that has done this with xml,txt or anny other kind of file?

Im using linux, lightHttp and latest RoR version.

Re: How to post xml files to another server?

You should just be able to post the xml as a string.

res = Net::HTTP.post(URI.parse('http://www.example.com/search.cgi'),
                              xml_string)

Re: How to post xml files to another server?

Ok, will that string be posted to the other servers file form field as a file?

I have done this in coldfusion with cfhttp and the cfhttpparam type=file, and therefore was not sure if it will work to post it as a data string.