Currently trying to upload files with formdata, having finding out what goes wrong with the following :
form = [
{
:file,
"textfile",
{"form-data", [name: "upload", filename: "myfile.txt"]},
["Content-Type": "text/plain"]
}
]
HTTPoison.post(
"https://www.googleapis.com/upload/drive/v3/files?uploadType=media",
{:multipart, form},
[Authorization: "xyz"],
[]
)
The thing gets uploaded over there at google drive. But all files are “corrupted”.
Here’s the kind of content of what is received (it should be a readable file, but looks like the ‘raw’ body lands over there) :
-----------------------------gjzhzfubqtjbctwv
content-length: 47
content-type: application/octet-stream
content-disposition: form-data; name=file; filename=a_file_name.txt
Something you fetched and now have it in memory
-----------------------------gjzhzfubqtjbctwv--
Googled around, found quite a bunch of topics around formdata with httpoison; looks like building the payload is quite difficult.
Does the code looks ok ? As I’m learning, I’m unsure if if need to investigate further in the formdata/httpoison side, or if it is related to the google drive api
Thanks a lot if any clues