提供独特的下载链接为我的用户托管在Amazon S3文件 [英] Give Unique download link for my users for files hosted on Amazon S3

查看:295
本文介绍了提供独特的下载链接为我的用户托管在Amazon S3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Amazon S3帐户中,我存储的MP3文件。我玩我的web应用程序的音乐播放器这些文件。我希望用户能够从我的网站下载的歌曲。我怎样才能让他们下载的文件的临时链接?我需要给他们的路径,在AS3的文件吗?我不希望链接与其他人共享。 这怎么可能呢? PS我建立在PHP中SoundManager类2中的应用程序和音乐播放器。

I have an Amazon S3 account in which I'm storing MP3 files. I play these files on a music player on my web app. I want the users to be able to download the songs from my site. How can I give them a temporary link to download the file? Do I need to give them the path to the file on AS3? I don't want the link to be shared with other people. How is it possible to do? P.S I'm building the app with PHP and the music player in SoundManager 2.

推荐答案

您可以创建一个在特定时间届满的URL。

You can create urls that expire at a specific time.

要生成它们将使用 SDK的PHP 和的 get_object_url 方法。

The easiest way to generate them would be to use the SDK for PHP and its get_object_url method.

// Instantiate the class
$s3 = new AmazonS3();

// Get the URL
$url = $s3->get_object_url('aws-php-sdk-test', 'mårkér wîth spåcés ånd întl/åéîøü.txt', '5 minutes', array(
    'response' => array(
        'content-type' => 'text/plain',
        'content-language' => 'en-US',
        'expires' => gmdate(DATE_RFC2822, strtotime('1 January 1980'))
    )
));

如果你是新的S3,你需要花一些时间,通过亚马逊在线文档。

If you are new to S3 you need to spend some time going through Amazons online documentation.

这篇关于提供独特的下载链接为我的用户托管在Amazon S3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆