Sadik Yalcin created CB-11881:
---------------------------------

             Summary: File transfer download onprogress
                 Key: CB-11881
                 URL: https://issues.apache.org/jira/browse/CB-11881
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin File Transfer
    Affects Versions: 6.3.1
         Environment: iPhone 6s Plus / iOS 9.2 Simulator
            Reporter: Sadik Yalcin


onprogress not triggering. I can't see anything wrong with my code - 
downloading/deleting success/error are all good.

{code:title=Code|borderStyle=solid}
window.requestFileSystem  = window.requestFileSystem || 
window.webkitRequestFileSystem;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, download, fail);

function download(fileSystem){
    var path = fileSystem.root.toURL();
    var fileURL = path + config.appDirName + '/' + filename + '.' + extension;
    var localpath = path + config.appDirName + '/' + filename + '.' + extension;
    fileURL = encodeURI(fileURL);

    var fileTransfer = new FileTransfer();
                                        
    fileTransfer.onprogress = function(progressEvent) {
        console.log('downloading..');
        if (progressEvent.lengthComputable) {
            var percent = progressEvent.loaded / progressEvent.total * 100;
            percent = Math.round(percent);
            $('#progress-'+documentsArticle.id).val(percent);
             console.log('Perc: ', percent);
        } else {
            console.log('downloading');
        }
    };

    fileTransfer.download(
        downloadurl,
        fileURL,
        function(entry) {    
            console.log('Download complete: ' + entry.toURL());
            ...
    },
    function(failed) {
        console.log('Download failed: ', failed);
        ...
    },
    true
    );
}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to