HTTPoison Post form with multiple files?

One file is fine, anyone know of how to properly post multiple files?

Looked into using multipart yet?

hackney: Send a body
httpoison: multipart upload

1 Like

Yep I have no issues with posting a form with one file trying to figure out how to do multiple files

Check the hackney (which httpoison uses) link - with multipart you can specify multiple {file, Path} parts.

1 Like

Yep just in case someone will be searching for this:!(url, {:multipart, 
       {:file, "/blah/file1", 
         {["form-data"], [name: "\"files1\"", filename: "\"/blah/file1\""]},[]},
       {:file, "/balh/file2", 
         {["form-data"], [name: "\"file2\"", filename: "\"/blah/file2\""]},[]}, ]}, [], [])
1 Like

After the second file, you close a ] where there is no opening [. I’ll try and see if it’s supposed to be a list or not, a bit confusing.

Experimented: second element in the :multipart tuple has to be a list.

For reference, see:

1 Like