The method signature is:
download(source, destination, successCallback, errorCallback);Where the parameters are:
source: The URL you want to download
destination: The full file path you want the file stored at
successCallback: called with a FileEntry object that represents the new file
errorCallback: called when something goes wrong
So say we want to download a PNG image and store it on the SD card. Well you'd write some code that looks like this:

7 comments:
Hi,
I've juste copy/paste your sample code, but it doesn't work
I'm running phonegap 1.3.0
2012-01-05 20:17:05.842 FileAssets[37881:13403] [INFO] >>> onDeviceReady
2012-01-05 20:17:05.843 FileAssets[37881:13403] File Transfer downloading file...
2012-01-05 20:17:06.943 FileAssets[37881:18a03] Write file /ics.png
2012-01-05 20:17:06.945 FileAssets[37881:13403] File Transfer Error: http://developer.android.com/assets/images/home/ics-android.png
2012-01-05 20:17:06.948 FileAssets[37881:13403] [INFO] download error source http://developer.android.com/assets/images/home/ics-android.png
2012-01-05 20:17:06.948 FileAssets[37881:13403] [INFO] download error target /ics.png
2012-01-05 20:17:06.949 FileAssets[37881:13403] [INFO] upload error code2
Can you help me?
@GIACOPINO
Do you have an SD Card? Do you have write external down as one of your permissions in your AndroidManifest.xml?
Hi simon
I'm on IOs...
Right so if you just copy and paste my code you won't have a "/sdcard". You should remove that bit from the sample and try again.
Hi again this is what i've done is you look at the output :
2012-01-05 20:17:06.943 FileAssets[37881:18a03] Write file /ics.png
I've also whitelist all url by "*"
I've tried :
path = '/ics.png' and path='ics.png' and always the same error
Tks for your help
I'm not really the iOS expert. You should come over to the PhoneGap Google Group and ask your question.
Done :
http://groups.google.com/group/phonegap/browse_thread/thread/7c3674b92587c9d0
Post a Comment