图像上传服务 - 图像位置和图像标识符

发布于 2024-07-12 05:02:23 字数 403 浏览 6 评论 0原文

我想创建一个图像上传服务(是的,我知道 imageshack、photobucket、flickr...等):)

我只看到 imageshack 显示图像所在的目录名称(“img294”、“1646”)位于,以同样的方式 - 我想这样做。

http://img294.imageshack.us/img294/1646 /**jquerykd5**.jpg

1) 如果我采用此实现,是否存在我应该注意的安全问题?

2) 这些网站如何提供简短的唯一标识符(“kd5”)?

感谢大家的建议和帮助。

I would like to create a image uploading service (yes, i am aware of imageshack, photobucket, flickr...etc) :)

I have seen only imageshack show the directory names ("img294", "1646") of where the image is located, in the same way - i would like to do this.

http://img294.imageshack.us/img294/1646/**jquerykd5**.jpg

1) Are there any security issues I should be aware if i take this implementation?

2) How do these sites come up with short unique identifiers ("kd5")?

Thanks all for any advice and help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幼儿园老大 2024-07-19 05:02:23

对于初学者来说,除非您希望该目录是公共的,否则请将虚拟的 index.html 文件放在那里,或者只是限制公共用户对这些目录的访问。

至于唯一标识符,有很多方法可以解决这个问题...我最喜欢使用的一些信息块:

  • UNIX 时间(如果运行基于 UNIX 的服务器)
  • 文件的 md5
  • 伪随机数
  • 原始数据块文件名

有了这些信息和许多其他信息,应该很容易防止重复的图像名称在服务器上发生冲突,您可以收集任意数量的图像并将它们连接成文件名的字符串。 md5 也可以放置在数据库中,以帮助重复图像检测方法,这也可以节省磁盘空间。

Well for starters, unless you would like the directory to be public, put dummy index.html files in there or just restrict access to public users for those directories.

As for the unique identifiers there are many ways of going about this... some of my favourite chunks of information to use:

  • UNIX time (if running a unix based server)
  • chunks of the md5 of the file
  • pseudo random numbers
  • piece of the original filename

With these and many other pieces of information at your fingertips it should be easy to prevent duplicate image names conflicting on your server as well, you can gather as many as you like and concatenate them into a string for the filename. The md5 can be placed in a database as well to aid in a method of duplicate image detection, which could save you disk space as well.

折戟 2024-07-19 05:02:23

我可以向你保证他们都使用URL重写。 这也将有助于解决安全问题。

I can promise you they all use URL rewriting. This will help with security issues, too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文