https://kotlinlang.org logo
#ktor
Title
# ktor
s

Sergioedcigreja

03/26/2019, 10:52 AM
Hey guys, does anyone have an example on how to send a Post request to an url with a File parameter? I’ve tried with submitFormWithBinaryData. When a File is detected it gets the inputStream.asInput(). However the response that I’m getting is not what’s expected.. any ideas?
g

gildor

03/26/2019, 11:35 AM
Maybe your server expects multipart/form-data, not raw binary
s

Sergioedcigreja

03/26/2019, 11:40 AM
I’ve also used the call(url) method where in the request builder I had body = MultiPartFormDataContent(formData { …. and it still didnt work
i created a stackoverflow question if you want to check the code
g

gildor

03/26/2019, 11:42 AM
but 401 means that your request is not authorized
s

Sergioedcigreja

03/26/2019, 11:43 AM
its authentication via the image that’s is why that error is returned 🙂
the request only requires the photo key and a image type png or jpg
3 Views