How I can upload list files from the client with ktor?
I try:
newPostDto.images.map {
append("images", it)
}
But its variant does not work.
How I can upload list files from the client with ktor?
I try:
newPostDto.images.map {
append("images", it)
}
But its variant does not work.
Here's an example (for more information you could check out this repo for a complete image file upload example)
client.submitFormWithBinaryData(
formData {
appendInput(key = ICON_FILE_PART, headers = Headers.build {
append(HttpHeaders.ContentDisposition, "filename=${appId}_ic")
}) {
buildPacket { writeFully(icon.toByteArray()) }
}
}) {
apiUrl("$APPLICATIONS_BASE_URL/${appId}/icon")
}