473,549 Members | 2,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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.QuerySt ring("vehicle_p hoto1")

On Error Resume Next

Set objFSO1=Server. CreateObject("S cripting.FileSy stemObject")

If objFSO1.FileExi sts(picLocation 1) Then
objFSO1.DeleteF ile (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 1494
shweta123
692 Recognized Expert Contributor
Hi,

Have you tried Server.MapPath( filename)?

Also Check "If objFSO1.FileExi sts(picLocation 1) " 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.QuerySt ring("vehicle_p hoto1")

On Error Resume Next

Set objFSO1=Server. CreateObject("S cripting.FileSy stemObject")

If objFSO1.FileExi sts(picLocation 1) Then
objFSO1.DeleteF ile (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
melchenyi
2 New Member
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
6815
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 Scripting.FileSystemObject to get the date that the file was last modified and to read/write a counter text file for the number of hits that the whole site...
2
2807
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, ForAppending = 8 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject")
2
7099
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 security reason. Here is my original code: <%
3
3429
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 which should open the other which is a simple text file - newText.txt . Here is readfile.asp : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0...
2
2300
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 size changes and I need to reflect that change. When using aspUpload I can reference it's built in File object references but they only refer to...
1
582
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 another server, using an ASP page which is on my server. Does someone help me? Thanks
7
8824
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 Scripting Runtime Library, you can retrieve information related to Drives, Folders, Files, and Text Files and set/retrieve certain Attributes of...
0
5148
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 methods to retrieve information from and how to manipulate them. The code should be self explanatory and basically documents itself. Should there be...
0
5405
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 various Methods to Copy, Move, and Delete them. The code is self explanatory, so I'll jump right in: Dim fso As FileSystemObject, fil As File 'Set fso...
0
7558
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7484
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7755
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7997
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7842
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5400
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5124
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3510
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
798
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.