Home
Sign Up
Sign In
V2EX
›
问与答
关于云存储分享同名的问题
wikinee
·
Aug 12, 2015
· 1930 views
This topic created in 4025 days ago, the information mentioned may be changed or developed.
像腾讯,百度他们,如果分享文件就算是同名,只要目录不同就行。这些是怎么做到的啊?目前只能做到MD5命名,不知道他们是怎么完成的?
5 replies
•
2015-08-12 16:39:06 +08:00
1
kslr
Aug 12, 2015
七牛那边文件名就是 "/dir/1.jpg"。
2
wikinee
OP
Aug 12, 2015
@
kslr
对啊,如果多人分享文件重名了,覆盖了怎么办。。。肯定要找个唯一标识啊
3
kslr
Aug 12, 2015
1
@
wikinee
你指的是多人的同名文件重叠吗? username+path映射就可以。
4
wikinee
OP
Aug 12, 2015
@
kslr
<a href=“xxxsss” download=“下载文件.txt”>file1</a>(html5)
囧,html5新特性download属性,暂时这样搞了,剩下的就是xxxsss唯一标识符的事情了
5
kslr
Aug 12, 2015
@
wikinee
这。。。 你是要做用户上传文件的东西?
上传到upload文件夹命名就用username+time+type或者各种能够分辨的就行
下载的时候指定header就可以
php伪代码
···php
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="name.pdf"');
readfile("$filename");
exit();
```
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
3115 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 21ms ·
UTC 14:24
·
PVG 22:24
·
LAX 07:24
·
JFK 10:24
♥ Do have faith in what you're doing.
❯