如何从文件夹中删除图像?
问题描述:
我使用图像控件在gridview中显示图像。所有图像都存储在文件夹中,我只是在数据库中保存该图像的路径。所以我想要帮助这样做,当我使用删除按钮从gridview中删除该图像时,它也将从该文件夹中删除。
I showing images in gridview using image control.That all images stored in folder,i just save path of that image in database.so i want help to doing like this,When i delete that image from gridview by using button of delete,it will also delete from that folder.
答
使用System.File类并调用File.Delete(路径)
http:// msdn .microsoft.com / zh-cn / library / system.io.file.delete(v = vs.110).aspx [ ^ ]
Use the System.File class and call File.Delete(path)
http://msdn.microsoft.com/en-us/library/system.io.file.delete(v=vs.110).aspx[^]