Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

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('&lt;p&gt;file was found and has been deleted&lt;/P&gt;');


}
else
{
Response.Write('Sorry this file does not exist');
}
</font id=code></pre id=code>

Any help would be appreciated,
Thanking you,
Olivier

Reply to this topic