473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 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 1491
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.