Status: Open
Status: Answered
Status: Closed
Status: Duplicate

Unable to Copy images from cache folder to any other folder

0
Posted Dec 19 by Nandini G.

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);

    };

4 Answers

0
BEST ANSWER: As chosen by the author.

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


0
BEST ANSWER: As chosen by the author.

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);

    };

0
BEST ANSWER: As chosen by the author.

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));
});

0
BEST ANSWER: As chosen by the author.

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 .
<!– cordova script (this will be a 404 during development) –>

&lt;script src=&quot;js/cordova.js&quot;&gt;&lt;/script&gt;

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.&lt;anonymous&gt; (ionic.bundle.js:53673)
at HTMLButtonElement.eventHandler (ionic.bundle.js:11841)
at triggerMouseEvent (ionic.bundle.js:2865)

 You have subscribed and will receive email notifications of updates to this topic. To unsubscribe, uncheck the checkbox.

Statistics

Related categories

Your answer

To leave an answer, please sign in.