Is there a possibility to do a multipart request without using Upload form control ? I see that RestClient isn't compliant with multipart. In my case Upload control is just a tool to get a file before modifying it. After this modification, I would like to add it to an authenticate multipart request that for now didn't know or see any way to make this multipart request
r
Robert Jaros
02/24/2021, 7:54 AM
Where do you keep your file data on the client side? A byte array? A base64 string?
j
Jamy
02/24/2021, 8:00 AM
It's a byte array
Jamy
02/24/2021, 8:11 AM
Is KFile content a base64 string ? Do you suggest to send a simple json to upload files ?
r
Robert Jaros
02/24/2021, 8:15 AM
you could try this:
Copy code
val byteArray = byteArrayOf(1, 2, 3)
val blob = Blob(arrayOf(byteArray), BlobPropertyBag("application/octet-stream"))
val formData = FormData()
formData.append("test", blob, "test.dat")
val result = RestClient().remoteCall("<http://localhost:5555>", formData, <http://HttpMethod.POST|HttpMethod.POST>, "multipart/form-data")
result.then<dynamic> {
console.log(it)
}