如何从asp.net中的文件夹中删除上传文件 [英] how to delete the upload file from the folder in asp.net

查看:105
本文介绍了如何从asp.net中的文件夹中删除上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在数据库中上传了一个文件,该文件也包含在asp.net中网站页面的文件夹中.
现在我想从数据库和文件夹中删除文件.我已成功删除
数据库中的文件,但文件并未从网站的文件夹中删除.
因此,请告诉我正确的答案.

I had uploaded a file in the database and that file is also contains by a folder of the website page in asp.net.
Now i want to delete the file from the database and the folder also. I have successfully deleted the
file from the database but file is not deleting from the folder of the website.
so tell me the proper answer.

推荐答案

if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + strpath))
                    File.Delete(AppDomain.CurrentDomain.BaseDirectory + strpath);




代替"Strpath"从数据库中检索文件路径




In place of "Strpath" retrieve the file path from database


您必须提供未能从文件夹中删除的示例代码,以便人们确实为您提供正确答案"!

Google有很多正确的答案:
- http://www.beansoftware.com/ASP.NET-FAQ/Delete -File-ASP.NET.aspx [ ^ ]

- http://www.aspnettutorials.com/tutorials/file/file-delfile-aspnet2 -csharp.aspx [ ^ ]

- http://tinyurl.com/3w545l5 [
You have to provide your sample code that is failing to delete from the folder for people to indeed give you a "proper answer"!

Google has alot of these proper answers:
- http://www.beansoftware.com/ASP.NET-FAQ/Delete-File-ASP.NET.aspx[^]

- http://www.aspnettutorials.com/tutorials/file/file-delfile-aspnet2-csharp.aspx[^]

- http://tinyurl.com/3w545l5[^]


这篇关于如何从asp.net中的文件夹中删除上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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