-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload DocumentFile to server #41
Comments
val media = documentFile.toMediaFile(context)
val path = media.absolutePath But there's no guarantee that the SAF will give you the actual path. Personally, I avoid using the absolute path for file management. Normally, an absolute path is used to show useful information to the user, whereas managing files is always with URI. |
I want to get the absolute path to create a file. I use that file to upload the it to server. What would you suggest to do here to be able to upload that file to the server? |
You can read the file via storage.onFileSelected = { _, files: List<DocumentFile> ->
files.first().openInputStream(context)?.use { stream ->
// upload stream to the server in Base64 format
// https://stackoverflow.com/q/42667942/3922207
}
} |
I also do validation for file type explicitly - for image types and pdf. (can be done with file name) can you suggest any method that can give me the size of the file in any way? |
|
Library version: 0.9.0
OS version: [Android 10]
Device model: [Vivo v11 Pro]
Describe the bug
Getting
getAbsolutePath{}
as blank but the name is there.To Reproduce
Stacktrace
The text was updated successfully, but these errors were encountered: