Created
July 11, 2011 04:27
-
-
Save khajer/1075316 to your computer and use it in GitHub Desktop.
download file (http) to filesystem (titanium)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var url='http://www.dogameok.com/image.jpg'; | |
| var httpClient = Titanium.Network.createHTTPClient(); | |
| var filepath = "data/image.jpg"; | |
| if (httpClient.open('GET', url)){ | |
| httpClient.receive(function(data){ | |
| var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filepath); | |
| var fileStream = file.open(Titanium.Filesystem.MODE_APPEND); | |
| fileStream.write(data); | |
| fileStream.close(); | |
| }); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Can you please tell me how can I download pdf file getting in response.
I am getting pdf url and pdf name in response.
Do I need to give any permission in manifest.