从下载中复制链接时阻止下载 [英] Prevent download while copy link from downloads

查看:91
本文介绍了从下载中复制链接时阻止下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前我从服务器下载文件。



下载下载的make链接。(crome)



假设我复制了这个链接并给了其他这个链接他也能够下载文件



如何防止这种情况?



我尝试了什么:


$ c $ b下载链接后的crome ..来自下载。



复制这个下载链接,并给他人用户..在我的电脑上打开它不是问题。但我给其他用户能够再次下载

我想阻止它。

currencty I am download files from the server.

while it downloads its make link for downloads.(crome)

suppose I copy this link and give other this link he also able to download file

how can I prevent that?

What I have tried:

in crome after download link ..see in downloads.

copy this download link and give to others user .. on my computer it open that's not an issue.but I give to other users is able to download it again
I want to prevent that.

推荐答案

这不是一件容易的事 - 如果你提供一个文件的下载链接,那么这个链接是直接的到文件,你不能轻易地阻止它。



相反,有一个下载页面,它接受一个指示文件的查询字符串 - 一个GUID是一个好主意,数据库将文件位置链接到GUID值(使用到期日也是一个好主意)。然后你给他们下载页面和查询字符串作为链接。



在你的页面中,你从查询中获取GUID值,检查数据库中的文件,并将其作为下载发送。然后,您可以清理数据库以激活GUID以供将来下载。
That's not trivial - if you provide a download link to a file, then that link is direct to the file, and you can't easily prevent it.

Instead, have a "downloads page" which accepts a query string indicating the file - a GUID is a good idea, which a database linking the file location to the GUID value (with an expiry date is also a good idea). You then give them the download page and query string as the link.

In your page, you fetch the GUID value from the query, check the DB for the file, and send it as a download. You can then clean out the database to invlaidate the GUID for future downloads.


这篇关于从下载中复制链接时阻止下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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