Unable to Copy images from cache folder to any other folder

Options

Hi All,

I am not able to copy images from default location to any other folder.Please suggest

Default location the images getting stored is:file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/cache/

self.copyImage=function () {
var awMobFileSys = new Appworks.AWMobileFileSystem();

        var source='file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/cache/img123.jpg';
        var dest='file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/files/img123.jpg';
        awMobFileSys.copy(source,false,dest,false,null,null);
        alert("source"+source);
        alert("dest"+dest);

        var source1='file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/cache/img123.jpg';
        var dest1='file:///storage/emulated/0/Pictures/img123.jpg';
        awMobFileSys.copy(source1,false,dest1,true,null,null);
        awMobFileSys.download('file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/cache/img123.jpg','file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/cache/img123.jpg',null,false,true,false);

    };

Comments

  • Hi, can you provide us with the error messages you are seeing?

  • Hi Jason,

    Thanks for your reply.
    The copy method is getting invoked but the files are not getting copied to the specified folder. Also ,I dont see any errors in the logs. Could you please share any sample example where the files are getting copied from source to destination.

    Below is the code where I am trying to copy images from one folder to another.
    self.copyImage=function () {
    var awMobFileSys = new Appworks.AWMobileFileSystem();

            var source='file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/cache/img123.jpg';
            var dest='file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/files/img123.jpg';
            awMobFileSys.copy(source,false,dest,false,null,null);
            alert("source"+source);
            alert("dest"+dest);
    
        };
    
  • Can you provide an error callback and a success callback and paste back the contents of those messages:

    var awMobFileSys = new Appworks.AWMobileFileSystem();
    var source = 'file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/cache/img123.jpg';
    var dest = 'file:///storage/emulated/0/Andriod/data/com.opentext.mobile.android/files/img123.jpg';
    awMobFileSys.copy(source,false,dest,false, (data) => {
       console.log(data);
       alert(JSON.stringify(data));
    }, error => {
       console.error(error);
       alert(JSON.stringify(error));
    });
    
  • Hi Jason,
    In the index.html,cordova script is shown as 404(File Not Found).Do I need to add cordova.js and cordova-pulgins? please let me know .

    Below are the two error messages in the console log:-
    1.http://localhost:63342/mobile/js/cordova.js 404 (Not Found)
    2.ionic.bundle.js:20434 TypeError: Cannot read property 'getPicture' of undefined
    at AWCamera.getPicture (camera.ts:17)
    at AWCamera.openGallery (camera.ts:29)
    at Object.self.openGallery (controllers.js:411)
    at $parseFunctionCall (ionic.bundle.js:21172)
    at ionic.bundle.js:53674
    at ChildScope.$eval (ionic.bundle.js:23228)
    at ChildScope.$apply (ionic.bundle.js:23327)
    at HTMLButtonElement. (ionic.bundle.js:53673)
    at HTMLButtonElement.eventHandler (ionic.bundle.js:11841)
    at triggerMouseEvent (ionic.bundle.js:2865)