提供独特的下载链接为我的用户托管在Amazon S3文件我的、下载链接、独特、文件

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

我有一个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.

阅读全文

相关推荐

最新文章