Good afternoon all, does anyone know the necessary codings to delete a file from the Web Server? I have tried the "Scripting-File" object, but it's still not working, any suggestions?

Have a pleasant day...

The FSO is the object you need to use. There could be an error in your code which is preventing it from working (wouldn't know without seeing your code), or more likely you do not have/have not set the required permissions on the folder/files you are trying to delete.

I have already set up the correct permissions for all the related folders, just that they are still not able to work, and I kept getting the "Internal Server Error: 500", do you have any idea where the problem is?

The codes are shown below, it's just a short one:

Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")

ScriptObject.DeleteFile(filename)

First step to help you debug is to turn off 'Show Friendly HTTP error messages' in your browser. This can be done by clicking on the Tools tab on teh toolbar, then Internet Options and select the Advanced tab. Scroll down through the Browsing section and uncheck teh box next to 'Show Friendly HTTP error messages'. Your browser will then display a much more meaningfull error message. Post the new error message here and we'll see what we can do to fix up your problem.

Thanks for your help, I have managed to find and solve the error, after changing the settings at the Internet Explorer..

I have added in the "Server.MapPath" method, and it works wonderously...thanks again, buddy...

Enjoy your day....

<%
dim FileName,FS1
FileName=Server.MapPath("<FolderName/Filename>")
Set FS1 = CreateObject("Scripting.FileSystemObject")
FS1.DeleteFile FileName
%>

For deleting the file, give ur foldername/filename like
FileName=Server.MapPath("Images/test.gif")

If u find this useful inform me...my Id is radha_992@yahoo.co.in

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.