PHP - 文件上传以及防止在 zip/rar 档案中上传病毒的方法
我试图在我的网站上提供一项服务,允许用户上传文件,以便其他人可以下载它们。
问题是,由于我允许上传的一些文件是 .zip/.rar 文件,我很好奇存在哪些想法可以帮助防止上传包含病毒/木马等的档案。一些 .zip 文件将包含合法的 .exe 文件,尽管我不确定我有什么选项。
我想了一下,我没有一种方法可以在服务器上使用病毒扫描程序进行验证,因为我在共享主机上,没有运行这样的服务的选项......我也不知道如何这样做。我还知道没有 php 类或数据库来扫描文件是否有病毒。这意味着,我唯一的选择是依靠:
a)。手动批准<--对我来说不是一个可接受的选择,因为它可能会成为一个有数千个上传的繁忙网站 b).让用户通过投票或“标记”等方式指出是否有病毒……
无论如何,关于“b” - 您会建议什么想法?
I am trying to provide a service on my website to allow users to upload files so others can download them.
The issue is, since some of these files I will allow to upload will be .zip/.rar files, I am curious as to what ideas exist to help prevent the uploading of archives with Viruses/trojans etc. included. Some .zip files will include legitimate .exe files,though I am not sure what options I have.
I thought about it and I don't have a method for verifying with a virus scanner on the server, since I am on shared hosting w/o the option to run a service like that... nor do I have the knowledge on how to do that. I am also aware there is no php class or database to scan the files for viruses. This means, my only options are to rely on:
a). manual approval <-- not an acceptable option for me as it might become a busy site with thousands of uploads
b). get the users to somehow point out it if has viruses through voting or "flagging", etc....
anyway, regarding "b" - what ideas would you suggest?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下载旁边有一个大的“报告病毒”按钮?手动批准这些应该是可能的。
或者在多次点击后将文件标记为“潜在危险”。
A big "report virus" button next to download? Manually approving these should be possible.
Or mark the file as "Potentially dangerous" after a number of clicks.
“报告”按钮听起来是个好主意,也许你也可以添加一个评论系统,让人们解释为什么他们认为该文件是病毒或只是一个无用的文件(并找到一种方法来“感谢”用户,就像 StackOverflow 上的声誉系统一样?)。
The "Report" button sounds like a good idea, maybe you could add a comment system too to allow people to explain why they think the file is a virus or simply a useless file (and find a way to "give thanks" to the user, like the reputation system on StackOverflow ?).