Base64 encoded file is working fine in another version but it is not working in android 10. I have used
this base64 package https://ionicframework.com/docs/v3/native/base64/.
It works when I work in the camera but not working when I tried to load a file from the gallery
Is there a specific reason you’re using that?
I need to encode the file in base64.It is working fine in lower android version and also works when i am using camera but it is not working when i tried to load a file from gallery.
There are a million ways to encode things in base64, and it’s difficult to know what exactly you mean by “the file”. I asked if there is a specific reason you’re using that particular plugin, because I would not bother to rely on a plugin to do base64.
Yes, I had also tried to read the file using file reader.It returns empty.I tried to upload file using file choose package.In android 10 file chooser return url like “content://com.android.providers.downloads.documents/document/msf%3A35” which includes % sign so it is not working where as other android version return url like content //com.android.providers.downloads.documents/document/39.
just do this encodeURI(url)
it is still not working not working
I have also tried using file reader.It is not working.Here is my code
this.fileChooser.open().then(uri =>{
let loading = this.loadingCtrl.create({
});
loading.present();
this.filePath.resolveNativePath(uri).then(filePath =>
{
this.file.resolveLocalFilesystemUrl(filePath).then(fileInfo =>
{
let files = fileInfo as FileEntry;
if (removeFile) {
this.data.projection_guide_files = ;
}
debugger
files.file((file) => {
var reader = new FileReader();
reader.onloadend = (e :any) => {
let result = e.target.result; // text content of the file
console.log(‘result’,result);
// check file loaded
};
reader.readAsDataURL(file);
});
}},
checkout this link it’s work for me