if ((System.IO.File.Exists(fileName)))
{
System.IO.File.Delete(fileName);
}
This is a simple code snippet in asp.net that can be used to delete files from any directory.
In here variable "fileName" is the specific path to the file.
Ex: If want to delete a file called "hello.pdf" in "upload" folder which is in my C drive, file name should be full path to that file "C:\upload\hello.pdf"
No comments:
Post a Comment