Still Can't Delete Files

K

Keith

Thought I would start another thread in case the other had dropped off
people's lists.

Still having problems here when trying to delete files off the server.

Using the code:

Set File = CreateObject("Scripting.FileSystemObject")
ImagePath =
Server.MapPath("..\..\..\sections\ezine\editions\images\articlethumbs\")
IssueNum = (RS_Content.Fields.Item("CON_Issue_Number").Value)
Image = (RS_Content.Fields.Item("CON_Image").Value)
ImagePath = ImagePath & "\" & IssueNum & "\" & Image
File.DeleteFile(ImagePath)

Everything I do shows that the recordset contains the correct values, but
the delete still gives me the following error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''
 
R

Rob Meade

Keith said:
Using the code:

Set File = CreateObject("Scripting.FileSystemObject")
ImagePath =
Server.MapPath("..\..\..\sections\ezine\editions\images\articlethumbs\")
IssueNum = (RS_Content.Fields.Item("CON_Issue_Number").Value)
Image = (RS_Content.Fields.Item("CON_Image").Value)
ImagePath = ImagePath & "\" & IssueNum & "\" & Image
File.DeleteFile(ImagePath)

Everything I do shows that the recordset contains the correct values, but
the delete still gives me the following error:

I dont remember seeing the other thread, and perhaps its already been
suggested, but what is displayed if you trying:

Response.Write ImagePath prior to File.DeleteFile(ImagePath) etc (dont type
in what you want, paste in what appears etc)

Regards

Rob
 
K

Keith

Rob Meade said:
I dont remember seeing the other thread, and perhaps its already been
suggested, but what is displayed if you trying:

Response.Write ImagePath prior to File.DeleteFile(ImagePath) etc (dont
type
in what you want, paste in what appears etc)

Regards

It returns what I expected it to - the path to the file on the server
incuding filename and extension.

This is what is so confusing - I KNOW that the values are there - it just
doesn't seem to want to use them.
 
P

Patrice

What if you do something like :
File.DeleteFile "c:\somefile" ?

For now I would though that File is not created correctly...

Does it work ?

Patrice
 
K

Keith

I found a way around it.

I set a session variable at the start of the document, use them instead of
referenced to the recordset, and then empty them at the end.

Messy, but works!

I still have no idea why referencing the recordset is not working though.
 
R

Roland Hall

in message : : >
: >> Using the code:
: >>
: >> Set File = CreateObject("Scripting.FileSystemObject")
: >> ImagePath =
: >>
Server.MapPath("..\..\..\sections\ezine\editions\images\articlethumbs\")
: >> IssueNum = (RS_Content.Fields.Item("CON_Issue_Number").Value)
: >> Image = (RS_Content.Fields.Item("CON_Image").Value)
: >> ImagePath = ImagePath & "\" & IssueNum & "\" & Image
: >> File.DeleteFile(ImagePath)
: >>
: >> Everything I do shows that the recordset contains the correct values,
but
: >> the delete still gives me the following error:
: >
: > I dont remember seeing the other thread, and perhaps its already been
: > suggested, but what is displayed if you trying:
: >
: > Response.Write ImagePath prior to File.DeleteFile(ImagePath) etc (dont
: > type
: > in what you want, paste in what appears etc)
: >
: > Regards
: >
:
: It returns what I expected it to - the path to the file on the server
: incuding filename and extension.

That's great. Can we see it?

: This is what is so confusing - I KNOW that the values are there - it just
: doesn't seem to want to use them.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top