什么是删除文件的安全方法 [英] What is a secure method to delete a file

查看:57
本文介绍了什么是删除文件的安全方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站.我将图像文件上传到目录"images".使用SQL查询,我会生成所需图像的列表,并且每个图像前面都有一个REMOVE链接.
我尚未为任何删除"链接赋予任何href值.我想使用一种安全的方式删除文件(这样,我的目录信息都不会出现在任何地方).当我单击删除"链接时,应该删除该文件.

解决方案

您应该调用
希望对您有所帮助.

-MRB


I am developing a site. I upload image files to a directory "images". using SQL query I generate a list of my required images and each image has a REMOVE link in front of it.
I have not given any href value to any REMOVE link yet. I want to use a secure way to delete the file (So that none of my directory info appears anywhere). What Should I do that When I click on the REMOVE link, the File should be removed.

You should call the unlink(string filename)[^] function...

Really easy to use... check it and come back if you have some issues...

HTH! :thumbsup:

PS: anyway a simple "delete files PHP" search in google would have given the same result...


Have a parameter action that specifies the action and also a parameter that identifies the image in the database (an ID column for instance). When the page is called with an action that corresponds to a delete take the parameter ID and fetch the path where it is in your directory structure from the database. Now you can delete it and nobody has seen anything for your directory structure.

Hope that helps you get started.

-MRB


这篇关于什么是删除文件的安全方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆