Community
cancel
Showing results for 
Search instead for 
Did you mean: 
David_R_7
Beginner
83 Views

Download an image to device

Jump to solution

Hello,

i´m creating an image gallery with "lightgallery", everything is correct except the download button that do nothing.

I´m trying flietransfer and file plugins but i´m doing something wrong.

I there any easy way to make a button to download images from the gallery i´ve created to the device?

Tags (2)
0 Kudos
1 Solution
Hamilton_Tenório_da_
Valued Contributor I
83 Views

David,

I am using File Transfer with success. See my code:

var ft = new FileTransfer(); 
var options = new FileUploadOptions(); 
var headers={'Authorization':'authHeader'}; 
ft.download( uri, fileURL + CNome, function(entry) {    //CNome is the name of my file
      $("#imgImagemEvento").attr("src", entry.toURL() + "/" & CNome );
      $('#divImagemEvento').show();
}, 
function(error) { 
      alert("download error source " + error.source); 
      alert("download error target " + error.target); 
      alert("upload error code" + error.code); },
true, options
); 

Try it.

Hamilton

View solution in original post

5 Replies
Hamilton_Tenório_da_
Valued Contributor I
84 Views

David,

I am using File Transfer with success. See my code:

var ft = new FileTransfer(); 
var options = new FileUploadOptions(); 
var headers={'Authorization':'authHeader'}; 
ft.download( uri, fileURL + CNome, function(entry) {    //CNome is the name of my file
      $("#imgImagemEvento").attr("src", entry.toURL() + "/" & CNome );
      $('#divImagemEvento').show();
}, 
function(error) { 
      alert("download error source " + error.source); 
      alert("download error target " + error.target); 
      alert("upload error code" + error.code); },
true, options
); 

Try it.

Hamilton

View solution in original post

David_R_7
Beginner
83 Views

Hi Hamilton,

Thanks a lot for your help :)

 

Hamilton_Tenório_da_
Valued Contributor I
83 Views

David> yes, the CNome is my variable with the file name. You can use any name to this variable or even put the name directly ( + "/yourFileName")

Hamilton

David_R_7
Beginner
83 Views

Thanks Hamilton,

I´m going crazy, i´m not sure what i´m doing wrong.... can i send you my project and check it?

Hamilton_Tenório_da_
Valued Contributor I
83 Views

David,

I can try. Send me in private.

Hamilton

Reply