Skip to content

Instantly share code, notes, and snippets.

@khajer
Created July 11, 2011 04:27
Show Gist options
  • Select an option

  • Save khajer/1075316 to your computer and use it in GitHub Desktop.

Select an option

Save khajer/1075316 to your computer and use it in GitHub Desktop.
download file (http) to filesystem (titanium)
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();
});
}
@nageshkatke1989

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment