Still Can't Delete Files

Discussion in 'ASP General' started by Keith, Jan 25, 2005.

  1. Keith

    Keith Guest

    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: ''
     
    Keith, Jan 25, 2005
    #1
    1. Advertising

  2. Keith

    Rob Meade Guest

    "Keith" <@.> wrote ...

    > 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
     
    Rob Meade, Jan 25, 2005
    #2
    1. Advertising

  3. Keith

    Keith Guest

    "Rob Meade" <> wrote in message
    news:TdrJd.18399$...
    > "Keith" <@.> wrote ...
    >
    >> 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.

    This is what is so confusing - I KNOW that the values are there - it just
    doesn't seem to want to use them.
     
    Keith, Jan 25, 2005
    #3
  4. Keith

    Patrice Guest

    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

    --

    "Keith" <@.> a écrit dans le message de
    news:%...
    > 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: ''
    >
    >
     
    Patrice, Jan 25, 2005
    #4
  5. Keith

    Keith Guest

    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.
     
    Keith, Jan 25, 2005
    #5
  6. Keith

    Roland Hall Guest

    "Keith" wrote in message news:%...
    : "Rob Meade" <> wrote in message
    : news:TdrJd.18399$...
    : > "Keith" <@.> wrote ...
    : >
    : >> 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
     
    Roland Hall, Jan 25, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9obiBCYWlsZXk=?=

    Can you still indicate to distribute files locally in ASP.Net 2.0

    =?Utf-8?B?Sm9obiBCYWlsZXk=?=, Jun 16, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    363
    =?Utf-8?B?Sm9obiBCYWlsZXk=?=
    Jun 16, 2005
  2. craig dicker
    Replies:
    1
    Views:
    375
    Peter Rilling
    Jul 10, 2005
  3. crazyprakash
    Replies:
    4
    Views:
    3,376
    adrian
    Oct 30, 2005
  4. PerlFAQ Server
    Replies:
    0
    Views:
    590
    PerlFAQ Server
    Feb 11, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    588
    PerlFAQ Server
    Mar 9, 2011
Loading...

Share This Page