Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49177

File Download

$
0
0

@Maheshvy wrote:

The File download is not working if the file name contain " : " only for dis special character .
Here is my code

var uri = "http://192.168.0.15/action_item/attachment/" + attach.attach_id +'/';
/*mobile not allow to download if filename have ":" symbole */
//var pos = attach.attach_user_filename.lastIndexOf( attach.attach_user_filename.charAt( attach.attach_user_filename.indexOf(":")+1) );
var downloadUrl = "///storage/emulated/0/Download/" + attach.attach_user_filename;
var fileTransfer = new FileTransfer();
var token = (localStorage.getItem('wizApp.refresh_token') ? localStorage.getItem('wizApp.refresh_token') : localStorage.getItem('wizApp.token'));
fileTransfer.download( uri, downloadUrl,
function(entry) {
alert("File Downloaded successfully");
},
function(error) {
alert(JSON.stringify(error));
console.log(JSON.stringify(error));
},
false,
{
headers: {
"Authorization": 'JWT ' + token
}
}
);

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>