Delete images from folder
HI, i want to delete images form folder dynamicaly, so please help me .....
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Lalit MPosted Mar 4, 2010, 4:45 AM
----------------
String imagePath = "~/ContentImages/Products/" + Image;
System.IO.FileInfo file1 = new System.IO.FileInfo(Server.MapPath(imagePath));
file1.Delete();
Nilanka DharmadasaPosted Dec 21, 2009, 3:49 AM
If it helped to you, please tick 'Do you like this answer' check box near my answer. It helps me a lot.
Munwar ZardariPosted Dec 21, 2009, 3:06 AM
Kirtan PatelPosted Dec 18, 2009, 6:48 AM
my email address is [email protected]
Nilanka DharmadasaPosted Dec 18, 2009, 3:48 AM
File.Delete(filepath);
This should work.
Ex:
File.Delete("C:\\abc.jpg");
If this doesnot work for you, then that must be an error in setting the path.
Can you paste your code?
Then I can look into it?
If this answer helps, please check' do you like thsi answer' check box.
Munwar ZardariPosted Dec 18, 2009, 3:14 AM
Munwar ZardariPosted Dec 18, 2009, 3:05 AM
Lalit MPosted Dec 18, 2009, 2:13 AM
http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=69922
http://www.dotnetheaven.com/Uploadfile/mahesh/DeleteFileorFolder05192005090452AM/DeleteFileorFolder.aspx
Lalit MPosted Dec 18, 2009, 2:05 AM
eg: Your folder name is images then
File.Delete(Server.MapPath("images") & "/" & "winter.jpg")
Nilanka DharmadasaPosted Dec 18, 2009, 2:03 AM