472,374 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

Scripting.FileSystemObject, No errorsm but file still left on server and not deleted!

Hi all, please help. I'm trying to delete image files from the local web server I'm testing on, the IIS. There is no error and whatsoever, but the function does not work. The files are still there and not deleted.

I have done a response.write and the image path file name is correct, but the file still is not deleted. Please see my code:


dim picLocation1
dim objFSO1

picLocation1 = Request.QueryString("vehicle_photo1")

On Error Resume Next

Set objFSO1=Server.CreateObject("Scripting.FileSystemO bject")

If objFSO1.FileExists(picLocation1) Then
objFSO1.DeleteFile (picLocation1)
End If

If Err.Number = 0 Then
Response.Write "File Deleted"
Else
Response.Write Err.Description
End If

set objFSO1=nothing

THANKS HEAPS!
Aug 9 '07 #1
2 1457
shweta123
692 Expert 512MB
Hi,

Have you tried Server.MapPath(filename)?

Also Check "If objFSO1.FileExists(picLocation1) " this statement is returning true or false?
There must be some mismatch between actual web server path and PicLocation1.

Hi all, please help. I'm trying to delete image files from the local web server I'm testing on, the IIS. There is no error and whatsoever, but the function does not work. The files are still there and not deleted.

I have done a response.write and the image path file name is correct, but the file still is not deleted. Please see my code:


dim picLocation1
dim objFSO1

picLocation1 = Request.QueryString("vehicle_photo1")

On Error Resume Next

Set objFSO1=Server.CreateObject("Scripting.FileSystemO bject")

If objFSO1.FileExists(picLocation1) Then
objFSO1.DeleteFile (picLocation1)
End If

If Err.Number = 0 Then
Response.Write "File Deleted"
Else
Response.Write Err.Description
End If

set objFSO1=nothing

THANKS HEAPS!
Aug 10 '07 #2
Hi shweta123

Thanks, I'm currently multi-tasking and doing some other stuff at the moment, I'll try your suggestion and let you know.. Thanks for replying.
Aug 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Wayfarer | last post by:
Hi, I've got a freebie hosting mirror of my production personal website (sounds kinda grandiose, doesn't it?) at http://journeys.webhostme.com/. At the production website I was using...
2
by: Fedroz | last post by:
Hi! Here is my problem: I'm trying a simple script copied by MSDN for read a text file and put the content on output web page! I use the following code: Const ForReading = 1, ForWriting = 2,...
2
by: Lin Ma | last post by:
Greetings, Is it possbile to check a file exist without using Server.CreateObject("Scripting.FileSystemObject") in asp page?? The reason is our hosting company turn that function off for...
3
by: bt | last post by:
I am just beginning with asp and have gotten an error that I need some help with. I posted a pair of files to an online ASP host server. The files are in the same directory; one is readfile.asp...
2
by: John | last post by:
Can't get this to work. I'm creating a workaround for the absence of aspJPEG on my server. I'm using aspUpload but my server only uses aspThumb. After aspThumb optimizes the original pic the file...
1
by: Sbroeff | last post by:
I would use the Scripting.FileSystemObject to find a file in a server, which I connect with a VPN connection. I'm not sure that the Scripting.FileSystemObject works with a folder, which is in...
7
ADezii
by: ADezii | last post by:
The next series of Tips will involve the Microsoft Scripting Runtime Library (Scrrun.dll). This Library is, in my humble opinion, one of the most useful and practical Libraries ever created. With the...
0
ADezii
by: ADezii | last post by:
This is the 2nd Tip in a series of Tips on the Microsoft Scripting Runtime Library. The 1st Tip related to Drives, while this Tip will concentrate on the Folders (Directories) in your PC and various...
0
ADezii
by: ADezii | last post by:
This is the 3rd in a series of Tips dealing specifically with the Microsoft Scripting Runtime Library. In this Tip, we'll show you how to return specific Properties relating to Files, as well as...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.