Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Retired
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10
My Carrier: Bell

Re: How to copy a pdf file from www folder to shared folder in BB10

This seems to have worked!!!! (assuming you have a function called fsError):

 

function copyFile() {

    var toDir = blackberry.io.sharedFolder + '/documents';
    console.log(toDir);
    var file = blackberry.io.home + '/../app/native/SampleFile.txt';
    console.log(file);
    blackberry.io.sandbox = false;


    window.webkitRequestFileSystem(
        window.TEMPORARY,
        1024 * 1024,
        function(fs) {
            fs.root.getFile(
                file,

                {create: false},
                function(entry) {
                    fs.root.getDirectory(
                        toDir,
                        {create: false},
                        function(folder) {
                            entry.copyTo(

                                folder,
                                null,
                                function() {
                                    console.log('Ahhhhhh yeahhhhhh');
                                },
                                fsError
                            );
                        },
                        fsError
                    );
                },
                fsError
            );
        },
        fsError
    );
}

------------------------------
@grahamzibar
-_- zZZ
Highlighted
New Contributor
Posts: 6
Registered: ‎06-12-2013
My Device: z10, q10
My Carrier: N/A

Re: How to copy a pdf file from www folder to shared folder in BB10

Finally, it works!!!

 

 

Thanks so much, grahamzlbar.