HTTP post file to URL

Tim Fletcher <>
Tue Jun 15 14:07:52 CEST 2010

> Is there any way in httpc module where I can post a file to the URL similar to the curl -f option?

Unless I'm mistaken, -f is the "fail silently" option, which I don't
think you want.

AFAIK you can stream a response *to* a file, but not stream a request
body *from* a file, which leaves you with something like this:

  {ok, Data} = file:read_file(Path).

  httpc:request(post, {URL, Headers, ContentType, Data}, [], []).

Is that what you're trying to do?


More information about the erlang-questions mailing list