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
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- My organization's project is blocked
My organization's project is blocked so unblocked my organization then I will this
- Can't Create An Account with Gmail Domai...
Hi, when using account.create() to register a new user with the Gmail domain, I got "There was an error processing your request. Please check the inputs and try...