RSS Forums RSS
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1924 | Replies: 5
Reply
Join Date: Mar 2006
Posts: 20
Reputation: SeekAnswers is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
SeekAnswers SeekAnswers is offline Offline
Newbie Poster

ASP: Deleting a file

  #1  
Apr 29th, 2006
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...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation: Lafinboy is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 7
Lafinboy's Avatar
Lafinboy Lafinboy is offline Offline
Junior Poster

Re: ASP: Deleting a file

  #2  
Apr 29th, 2006
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.
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.

Lafinboy Productions
:: Website Design :: Website Development ::

Reply With Quote  
Join Date: Mar 2006
Posts: 20
Reputation: SeekAnswers is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
SeekAnswers SeekAnswers is offline Offline
Newbie Poster

Re: ASP: Deleting a file

  #3  
May 1st, 2006
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)
Reply With Quote  
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation: Lafinboy is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 7
Lafinboy's Avatar
Lafinboy Lafinboy is offline Offline
Junior Poster

Re: ASP: Deleting a file

  #4  
May 1st, 2006
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.
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.

Lafinboy Productions
:: Website Design :: Website Development ::

Reply With Quote  
Join Date: Mar 2006
Posts: 20
Reputation: SeekAnswers is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
SeekAnswers SeekAnswers is offline Offline
Newbie Poster

Re: ASP: Deleting a file

  #5  
May 2nd, 2006
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....
Reply With Quote  
Join Date: May 2006
Posts: 6
Reputation: radharadha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
radharadha radharadha is offline Offline
Newbie Poster

Re: ASP: Deleting a file

  #6  
May 15th, 2006
<%
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:50 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC