You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Sadik Yalcin (JIRA)" <ji...@apache.org> on 2017/07/13 10:31:00 UTC

[jira] [Closed] (CB-11881) File transfer download onprogress

     [ https://issues.apache.org/jira/browse/CB-11881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sadik Yalcin closed CB-11881.
-----------------------------
    Resolution: Unresolved

> File transfer download onprogress
> ---------------------------------
>
>                 Key: CB-11881
>                 URL: https://issues.apache.org/jira/browse/CB-11881
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-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.4.14#64029)

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