@Aleksei Tirman [JB]
As a multipart, I just don't inform the object that I will receive between <>, right?
it will loop through each key and value and perform the given logic.
in the example, it could be
Copy code
data class SomeClass (
name: String,
age: int,
}
Copy code
multipartData.forEachPart { part ->
when (part) {
is PartData.FormItem -> {
fileDescription = part.value
add each value to someClass class ???
}
is PartData.FileItem -> {
fileName = part.originalFileName as String
var fileBytes = part.streamProvider().readBytes()
File("uploads/$fileName").writeBytes(fileBytes)
}
else -> {}
}
write someClass to the database
a
Aleksei Tirman [JB]
10/03/2022, 10:59 AM
Yes.
e
ESchouten
10/03/2022, 1:57 PM
Alternately, you could encode the pfd to base64 string and decode it in the server