Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70914

File error code 5 message encoding_err photo library

$
0
0

Current behavior:
When I choose some photos from the gallery (example one that is in the Whatsapp folder) it is not possible to copy to another directory

Expected behavior:
file error code 5 message encoding_err

Steps to reproduce:
Choose photos from other folders in the gallery

Related code:

this.camera.getPicture(options).then((imagePath) => {
            if (this.platform.is('android') && sourceType === this.camera.PictureSourceType.PHOTOLIBRARY) {

      

                this.filePath.resolveNativePath(imagePath)
                    .then(filePath => {
                        
                        let correctPath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
                        let currentName = imagePath.substring(imagePath.lastIndexOf('/') + 1, imagePath.lastIndexOf('?'));
                      
                        this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
                    });
            } else {
                var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
                var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
                this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
            }


        }, (err) => {
            // Handle error
        });

private copyFileToLocalDir(namePath, currentName, newFileName) {
        
        this.file.copyFile(namePath, currentName, cordova.file.dataDirectory, newFileName).then(success => {
            this.nameImage = newFileName;
            this.uploadImageServer()
        }, error => {
            console.log(error);
            
        });
    }

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70914

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>