Hi I'm trying to upload a file (small) using ktor...
# multiplatform
a
Hi I'm trying to upload a file (small) using ktor (android/iOS) , I can see some old snippet, any new flows ? also are these right approaches • pass base64 (platform) -> convert to ByteArray (common) -> make request • pass file uri -> read file (expect/actual in common) -> ByteArray -> make request
h
any idea of this
a
hey @hafiz This was last year, i think now there has to be a way to read ByteArray i went with the bae64 approach since then, it was easy create a helper class
Copy code
data class File(val name:String,val base64:String,val type:String?=null)
then just decode the base64 into byearray and send in ktor
h
@Ahmed na I have byteArray image from third party library give but problem is that this byteArray still can't upload to the server.
a
hi @hafiz I've shared this under my core lib, see if it helps it's need early access add this in your
dependencyResolutionManagement
Copy code
maven { url = uri("<https://s01.oss.sonatype.org/content/groups/staging>") }
https://kmp.telereso.io/core/FileRequest.html
1
h
thanks @Ahmed na