PHP文件上传安全性-保留原始文件名 [英] PHP File upload security - keeping the original file name
本文介绍了PHP文件上传安全性-保留原始文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想允许网站( PHP )的注册用户上传文件(文档),这些文件将公开供下载. 在这种情况下,我保留文件的原始名称是否存在漏洞? 如果它是一个,我想知道为什么,以及如何摆脱它.
I want to allow registered users of a website (PHP) to upload files (documents), which are going to be publicly available for download. In this context, is the fact that I keep the file's original name a vulnerability ? If it is one, I would like to know why, and how to get rid of it.
推荐答案
这取决于文件名的存储位置.如果将名称存储在数据库中,则使用严格类型化的变量,然后在将其显示在网页上之前先进行HTML编码,就不会有任何问题.
That depends where you store the filename. If you store the name in a database, in strictly typed variable, then HTML encode before you display it on a web page, there won't be any issues.
这篇关于PHP文件上传安全性-保留原始文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文