Hi guys👋 My android project contains three modules: 1. app 2. ui(jetpack compose) 3. sdk(kotlin multiplatform, ktor client)
So I’m making requests to server in sdk(kotlin multiplatform) module. I want to upload file via multipart-form-data, but there is no support for java.io.file in kotlin multiplatform. Have you got any idea to solve this problem?
1 year ago
I have not used a lot of the things in this setup but have an idea of how it might work. How would you send some random bytes of data from a byte array?
If that works then there might be some other library to handle files in KMP or you can just write your own file class using expect/actual. I did similar for java.util.date recently.
Basically each platform needs to do its implementation of file io (via library or you code it) which can abstract it so KMP can use it. ktor client is doing that for the network layer