Can I use rest-client to POST a binary file to HTTP without multipart?
Posted
by Angela
on Stack Overflow
See other posts from Stack Overflow
or by Angela
Published on 2010-05-28T21:09:48Z
Indexed on
2010/05/28
21:12 UTC
Read the original article
Hit count: 244
http-post
|rest-client
I have tried to do the following, but the web-service is NOT REST and does not take multi-part. What do I do in order to POST the image?
@response = RestClient.post('http://www.postful.com/service/upload',
{:upload => {
:file => File.new("#{@postalcard.postalimage.path}",'rb')
}
},
{"Content-Type" => @postalcard.postalimage.content_type,
"Content-Length" => @postalcard.postalimage.size,
"Authorization" => 'Basic xxxxxx'
} # end headers
) #close arguments to Restclient.post
© Stack Overflow or respective owner