保护匿名图像上传

发布于 2024-10-05 11:36:55 字数 226 浏览 1 评论 0原文

www.ebayclassifieds.com 等网站允许用户上传图像,以便在发布内容之前查看缩略图预览并进行图像调整。访问者可以在未经任何事先授权的情况下匿名将图像上传到这些网站。

是否可以为具有带宽和磁盘空间限制的较小站点完成相同类型的图像预览?我猜想人们会设置一个 cron 作业来定期删除匿名上传的图像。但是,如果有人试图通过上传虚假图像向您的网站发送垃圾邮件,可以采取哪些其他措施来确保带宽使用和磁盘空间不失控?

Sites like www.ebayclassifieds.com let users upload images in order to see thumbnail previews and make image adjustments before posting content. Visitors are able to upload images to those sites anonymously without any authorization beforehand.

Can the same type of image previews be done for a smaller site that has bandwidth and disk space constraints? I'd guess that one would set up a cron job to periodically delete images that were anonymously uploaded. But what are other measures that can be taken so that bandwidth usage and disk space don't get out of hand, in case someone tries to spam your site with bogus image uploads?

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

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

发布评论

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

评论(2

深居我梦 2024-10-12 11:36:55

以下是我的一些想法:

  1. 使用会话状态来跟踪上传的文件,并在会话过期时自动删除它们。
  2. 限制每个会话/访问者的上传次数(即每个匿名访问者一次)
  3. 限制可以上传的文件的最大大小。
  4. 将图像类型限制为仅压缩的图像(即不允许 BMP)
  5. 上传图像后立即将图像缩小到合理的大小。您可能不需要全尺寸。

Here are some ideas off the top of my head:

  1. Use session state to keep track of uploaded files and delete them automatically when the session expires.
  2. Limit uploads per session/visitor (ie. one per anonymous visitor)
  3. Limit the maximum size of a file that can be uploaded.
  4. Limit image types to only those that are compressed (ie. don't allow BMPs)
  5. Scale the images down to a reasonable size as soon as they are uploaded. You probably don't need full size.
风吹过旳痕迹 2024-10-12 11:36:55

除了 madisonw 的答案之外,我还想补充一点,也使用验证码进行上传,这样用户就无法使用自动化工具来大量上传图像......

Besides madisonw's answer I would just add, use CAPTCHA for the upload as well, so users can't use automated tools to upload the images at large...

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