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
- Android SDK: Kotlin null Value Not Updat...
Hi team, I think you should check the Android SDK implementation once, as it seems to have an issue handling Kotlin **null** values. For example: When I send:...
- OAuth Missing redirect URL
Hello all, on a Flutter mobile app with latest Appwrite dependency (25.4.0) I always got "Missing redirect URL" - "Your OAuth login flow is missing a proper red...
- Need Help on Self Hosted Version of Appw...
Hi i wanted to test SMS OTP verify method but i am not able to do it. I follow all the steps but no luck. Please help me with this. I am using Appwrite self hos...