从应用程序文件夹中删除图像 [英] deleting image from application folder

查看:81
本文介绍了从应用程序文件夹中删除图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用一个asp.net应用程序.我想从文件夹``image''中删除一个特定的图像.Image文件夹位于应用程序本身中.当我从gridview中删除一些信息时,然后在''中对应的图像图片''文件夹应删除.请帮忙.(网格视图中有图像名称)

Hi,
I am working with an asp.net application.I want to delete a particular image from a folder ''image''.Image folder is located in application itself.When i am deleting some information from gridview ,then corresponding image in the ''image'' folder should delete. Please help.(Image name is there in the grid view)

推荐答案

有什么需要做的吗?一个简单的谷歌搜索将对您有所帮助.
以下是可用于开始的代码段:

Any effort? A simple google search would have helped you.
Below is a code snippet you can use to start with:

FileInfo TheFile = new FileInfo(MapPath(".") + "\\image\\" + LstrFileName);
if (TheFile.Exists)
{
    File.Delete(MapPath(".") + "\\image\\" + LstrFileName);
}
else
{
    throw new FileNotFoundException();
}


这篇关于从应用程序文件夹中删除图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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