I want to create a one time download link to an amazon s3 hosted file. This link expires once the file has been downloaded.

我想创建一个亚马逊s3托管文件的一次性下载链接。文件下载后,此链接将过期。

I want this file to still be hosted but a visitor can only download the file once.

我希望仍然可以托管此文件,但访问者只能下载一次该文件。

The scenario I need this for is: I have a file download website where users pay for a file. I want the user to only be able to download the file once from the website (and Amazon s3), I also do not want the user to be able to share a direct download link with other people.

我需要这个场景是:我有一个文件下载网站,用户在那里支付文件费用。我希望用户只能从网站(和亚马逊s3)下载文件一次,我也不希望用户能够与其他人共享直接下载链接。

If this isn't possible I wonder if it is more efficient to limit it by an IP address or Cookie if possible?

如果这是不可能的,我想知道如果可能的话,用IP地址或Cookie来限制它是否更有效?

3 个解决方案

#1


13

There is no way to tell S3 to allow a link to be used only once. But you can create a link that can only be used until a specified time. What I do is redirect the requester to an S3 link that expires in a few minutes, so he or she doesn't have time to share it. You can make that expiration time very short, even a few seconds, so long as their browser has time to receive the redirect response and follow it.

无法告诉S3允许链接仅使用一次。但是您可以创建一个只能在指定时间之前使用的链接。我所做的是将请求者重定向到几分钟内到期的S3链接,因此他或她没有时间分享它。只要浏览器有时间接收重定向响应并遵循它,您就可以将到期时间设置得非常短,甚至几秒钟。

更多相关文章

  1. 使用javascript将文件输入到php文件
  2. 迭代文件夹中的CSV文件,并使用PHP将数据加载到MySQL中
  3. 用于cdn集成的文件类型的域更改正则表达式
  4. PHP基础 文件流
  5. 教你如何利用php.exe运行php文件
  6. Laravel尝试在根文件夹中存储缓存文件
  7. php之简单的文件管理(基本功能)
  8. 从文本文件中读取,然后决定是否要在php中禁用或启用按钮
  9. php删除指定目录下的的文件/文件夹-用PHP怎么删除某目录下指定的

随机推荐

  1. EditText小总结
  2. 【Android】Android 代码判断是否获取ROO
  3. Android Gradle 编译问题汇总
  4. Android SDK大连东软镜像地址及地址列表
  5. android manifest.xml中元素含义android
  6. 详解android:scaleType属性
  7. Android PagerTabStrip和PagerTitleStrip
  8. 最新Android ADT, SDK, SDK_tool等官方下
  9. [Android]"@string/hello"和"你好"的区别
  10. Android 布局属性详解