Hey Ara,
It is very similar to multipart email encoding:
Add this to the post headers:
CONTENT_LENGTH: #{the total length or the body of the message with all
boundaries}
CONTENT_TYPE: multipart/form-data;
boundary=---------------------------41184676334
Then have a blank line. Then the body:
-----------------------------41184676334
Content-Disposition: form-data; name="file"; filename="example.txt"
Content-Type: text/plain
This is the content of a text file.
-----------------------------41184676334
Content-Disposition: form-data; name="foo"
bar
-----------------------------41184676334
Content-Disposition: form-data; name="bar"
foo
-----------------------------41184676334--
Don't forget the trailing -- after the last divider.
You could also use curl on the command line:
curl -F foo=bar -F bar=foo file=@/path/to/file uri
Dan
Ara.T.Howard wrote:
>
> i'm trying to do something like
>
> form = {
> "foo" => "bar",
> "bar" => "foo",
> "file" => IO::read(file),
> }
>
> client.post_content uri, form
>
> eg. mixed form input. what's the mechanism to get http-access2 to
> turn this
> request into a multipart form upload?
>
> regards.
>
> -a