Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
AditSheth 13-Sep-11 8:28am    
please provide your code for delete image.
if you got any error? or its work but not deleted..
Check folder permission... give all permission to user

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



In place of "Strpath" retrieve the file path from database
 
Share this answer
 
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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900