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
- Subscription Problem
I'm making an app in RN with Expo and Appwrite and there's a functionality which allows the user to create a task/test (i'll be reffering to them collectively a...
- Auth not working on expo react native
I'm trying to launch a development server with expo go and appwrite as a backend. On my windows pc, I've got a local docker instance of appwrite running as my b...
- Bug Report: Crash when trying to createR...
https://github.com/appwrite/sdk-for-android/issues/96 I think the bug is related with this one https://discord.com/channels/564160730845151244/1443887021314539...