Hi there,
I am currently trying to call an outside API from my elixir/phoenix API using HTTPoison for some POST and GET requests. I am stuck for File uploads.
I will receive as parameters to my API the parameters to send to the outside API and I need to extract the Plug.Upload structure to convert it to a FormData.File structure so that I can use it for httpoison-form-data
Example of an input MAP:
%{
"one" => "test",
"two" => "3",
"myFile" => %Plug.Upload{
content_type: "application/vnd.ms-excel",
filename: "TEST.xls",
path: "/tmp/some_path/multipart-123456789"
}
}
The problem is I will not necessary know to which key of the map the structure will be associated, is there a way I can check by its type to convert it maybe ?
Thanks in advance for your help.