【问题标题】:Download File from Amazon S3 Bucket in Titanium从 Titanium 中的 Amazon S3 存储桶下载文件
【发布时间】:2013-02-16 09:27:57
【问题描述】:

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

谁能帮我解决这个问题

提前致谢

【问题讨论】:

  • 您要下载特定的已知文件,还是完整的存储桶?
  • 你已经尝试了什么?

标签: iphone ios amazon-s3 titanium titanium-mobile


【解决方案1】:
 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);

【讨论】:

    猜你喜欢
    • 2015-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-09
    • 2015-05-20
    • 2017-02-16
    • 2013-10-15
    • 2019-09-06
    相关资源
    最近更新 更多