2013-02-16 155 views
0

我想知道使用Appcelerator Titanium从Amazon S3存储桶下载文件对象的方法。从Titanium下载Amazon S3存储桶中的文件

谁能帮我这个

在此先感谢

+0

你想下载一个特定的已知的文件,或者完整的桶? – 2013-02-16 16:43:18

+0

你已经试过了什么? – 2013-02-16 16:58:38

回答

0
var downloadingFileUrl = "Url of the file that need to be downloaded" 

//File path where downloaded file will be saved 
var fileSavingPath = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,"file_Path"); 

//Define the http client 
var myHttpClient = Ti.Network.createHTTPClient(); 

//On success of downloading 
myHttpClient.onload = function(){ 

//Write the file to the desired path 
fileSavingPath.write(httpClient.responseData); 
}; 

//Open the url to download 
myHttpClient.open("GET", downloadingFileUrl); 

//Send request 
myHttpClient.send(null); 
相关问题