in logcat
what's the code that you're running to log the stacktrace?
its not stacktrace , its logcat
would you please share the full stacktrace?
java.lang.IllegalArgumentException: No subtype found for: ""
at okhttp3.MediaType$Companion.get(MediaType.kt:111)
at io.appwrite.Client.chunkedUpload(Client.kt:365)
at io.appwrite.services.Storage.createFile(Storage.kt:95)
at io.appwrite.services.Storage.createFile$default(Storage.kt:72)
at
Please use 3 backticks instead of 1 for multi line code
at okhttp3.MediaType$Companion.get(MediaType.kt:111)
at io.appwrite.Client.chunkedUpload(Client.kt:365)
at io.appwrite.services.Storage.createFile(Storage.kt:95)
at io.appwrite.services.Storage.createFile$default(Storage.kt:72)
at ```
at okhttp3.MediaType$Companion.get(MediaType.kt:111)
at io.appwrite.Client.chunkedUpload(Client.kt:365)
at io.appwrite.services.Storage.createFile(Storage.kt:95)
at io.appwrite.services.Storage.createFile$default(Storage.kt:72)
at ```
3 backticks also goes same
The formatting is a little different if you look closely
It seems input mime type is an empty string
but some image uploaded successfully without any error
yes
Because some images are passing the mime type
so what should we do?
Figure out when the mime type is empty and then fix it
its not true , i have printed mime type it gives mime type to both image
image/jpeg
what's yoru code?
val inputStream = contentResolver.openInputStream(PickedImageUri!!)
val mimeType = contentResolver.getType(PickedImageUri!!)
val source: BufferedSource = inputStream!!.source().buffer()
val byteArray = source.readByteArray()
Log.d("jnm",mimeType.toString())
userViewModel.saveImage(InputFile.fromBytes(byteArray!!, mimeType ?: "image/jpeg"))
}```
in here, before you create the file, would you please log file.mimeType?
image/jpeg comes
this comes in result
what's the new code?
it also looks like you're missing the file name argument to InputFile.fromBytes()
Recommended threads
- Appwrite rejecting create and edit reque...
hello, so my issue is that when i make a debug build of my app, everything works as it should, but when i download and test a SIGNED release database rejects al...
- {"code": 1008, "message": "Invalid Origi...
Nothing has changed in my application or console settings so I'm curious as to what I need to do to fix this. I already have the client registered so I'm not en...
- android platform invaild origina
It happened today suddenly. Our app says invalid origin. And appwrite cloud says every time we tried to add the app to it: "param platformId" is not optional.