Forums
This topic is locked
problems using DeleteFile() to delete an image in
Posted 30 Aug 2004 13:02:42
1
has voted
30 Aug 2004 13:02:42 Olivier Florence posted:
Hi,I am trying to delete an image in a folder on my own IIS (for the time being), when I run the following scripts the page takes several minutes to load and eventually IIS crashes.
here is the code I am using:
<pre id=code><font face=courier size=2 id=code>
var fso= Server.CreateObject("Scripting.FileSystemObject"
//collect the full file path
//this seems to be working OK as I get the message intended if the file is found
var file = Server.MapPath("\properties\\pop_images\\1.jpg"
//check if the file exist and delete if it does
if (fso.FileExists(file)==true)
{
fso.DeleteFile(file);
Response.Write('<p>file was found and has been deleted</P>');
}
else
{
Response.Write('Sorry this file does not exist');
}
</font id=code></pre id=code>
Any help would be appreciated,
Thanking you,
Olivier