Saqib ahsan
01/15/2025, 12:26 PMktor
client but getting 422 Unprocessable Entity
also debugged a code with backend guy he said the request isn’t perfectSaqib ahsan
01/15/2025, 12:28 PMsuspend fun uploadFile(file: File, mimeType: String) = <http://client.post|client.post>(buildUrl(UPLOAD_FILE)) {
setBody(
MultiPartFormDataContent(
formData {
append("file", file.readBytes(),
Headers.build {
append(HttpHeaders.ContentType, mimeType)
append(HttpHeaders.ContentDisposition, "form-data; name=\"file\"; filename=\"${file.name}\"")
}
)
}, boundary = "WebAppBoundary"
)
)
}
here is the code which am trying to upload a fileSaqib ahsan
01/15/2025, 12:28 PMChrimaeon
01/15/2025, 5:12 PMChrimaeon
01/15/2025, 5:13 PMwith backend guy he said the request isn’t perfectso he should tell you whats wrong 😅
Saqib ahsan
01/16/2025, 7:05 AMheadersOf(
HttpHeaders.ContentDisposition, "filename=${file.name}"
)
🙂