Monday, June 29, 2009

Delete File in ASP

Yes, you can delete a file by using FileSystem Object in ASP

// delete file
var FSO = Server.CreateObject("Scripting.FileSystemObject");
// get path to file
PathFile = Server.MapPath("/path/folder/deletefilename);
// if file exists, delete it
if(FSO.FileExists(PathFile)) FSO.DeleteFile(sPathToFile)
// file deleted


like this way we can create , delete folder using FSO (file system object)
to know more about FSO system

No comments:

Post a Comment