2

I'm working on an phonegap app for iphone, But, now i'm in trouble to find a way do download images from the server to the iphone gallery...

I have these small code that gets the file content:

var req = new XMLHttpRequest();  
req.open('GET',"http://site.com/imagefile.jpg", false);   
req.send(); 

But, I dont know how to force to save it. If not possible this way, I can also get the image file codeded into base64... I dont think if this will help something.

Could you please, give me some explanation?

I googled a lot, but I didnt find samples...

valter
  • 418
  • 9
  • 24

1 Answers1

0

You can't save to iphone photo's folder with Phonegap (without writing an extension at least). So you can't really save the photo's to a file (again without an extension), the only real way to save photos in a cross-platform (and thus phonegap html & Javascript way) way is to save them to a local sqlite database. See Jesse MacFayden's article on doing this on the Phonegap site. Jesse leaves the actual saving of the image to database and loading it as a work for the reader, but if you have problems with that I just wrote an answer on how to use the database in Phonegap just this morning.

Community
  • 1
  • 1
Kris Erickson
  • 33,454
  • 26
  • 120
  • 175