-
Notifications
You must be signed in to change notification settings - Fork 340
Closed
Description
Not sure what to title this
Trying to upload a file using {:file, "/path/to/file"} to https://p.fuwafuwa.moe does not work.
curl can do it.
Here are the differences between how curl and httpoison does it:
curl
curl --silent -sf -F files\[\]="@test.txt" http://httpbin.org/post
{
"args": {},
"data": "",
"files": {
"files[]": "testlmao\n"
},
"form": {},
"headers": {
"Accept": "*/*",
"Content-Length": "198",
"Content-Type": "multipart/form-data; boundary=------------------------d7914e35b1cf9114",
"Host": "httpbin.org",
"User-Agent": "curl/7.46.0"
},
"json": null,
"origin": "redacted",
"url": "http://httpbin.org/post"
}
When we try to upload to fuwafuwa.moe:
(JSON response)
{"success":true,"files":[{"hash":"7ddd25022f061412a0ee899eb48928ff697b53d9","name":"test.txt","url":"https:\/\/p.fuwafuwa.moe\/gcctxc.txt","size":9}]}
and
httpoison
HTTPoison.post("http://httpbin.org/post", {:file, "test.txt"})
{
"args": {},
"data": "testlmao",
"files": {},
"form": {},
"headers": {
"Content-Length": "9",
"Content-Type": "text/plain",
"Host": "httpbin.org",
"User-Agent": "hackney/1.6.0"
},
"json": null,
"origin": "redacted",
"url": "http://httpbin.org/post"
}
When we try to upload a file to fuwafuwa.moe:
(JSON response)
{"success":false,"errorcode":400,"description":"No input file(s)"}
Edit: Found the solution.
HTTPoison.post("https://p.fuwafuwa.moe/upload.php", {:multipart, [{:file, "test.txt", {"form-data", [{"name", "files[]"}, {"filename", "testus.txt"}]}, []}]})
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels