Professional Web Applications Themes

How to open a file in the current directory - ASP

Set fileSystem = Server.CreateObject( "Scripting.FileSystemObject" ) Set file = fileSystem.OpenTextFile( "config.xml", 1, False ) It's saying that 'config.xml' doesn't exist. How can I reference this file? It's in the same directory as the file with the above code. Do I need to build the path somehow? ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- [url]http://www.newsfeed.com[/url] The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---...

  1. #1

    Default How to open a file in the current directory

    Set fileSystem = Server.CreateObject( "Scripting.FileSystemObject" )
    Set file = fileSystem.OpenTextFile( "config.xml", 1, False )

    It's saying that 'config.xml' doesn't exist. How can I reference this file?
    It's in the same directory as the file with the above code. Do I need to
    build the path somehow?




    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    [url]http://www.newsfeed.com[/url] The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
    Anonymous Guest

  2. #2

    Default Re: How to open a file in the current directory

    Set file = fileSystem.OpenTextFile(Server.MapPath("config.xml "), 1, False)

    This assumes Windows 2000 or later.

    Ray at home

    --
    Will trade ASP help for SQL Server help


    "Anonymous" <Nobody> wrote in message news:3f32cf11_6127.0.0.1...
    > Set fileSystem = Server.CreateObject( "Scripting.FileSystemObject" )
    > Set file = fileSystem.OpenTextFile( "config.xml", 1, False )
    >
    > It's saying that 'config.xml' doesn't exist. How can I reference this
    file?
    > It's in the same directory as the file with the above code. Do I need to
    > build the path somehow?
    >
    >
    >
    >
    > ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
    News==----
    > [url]http://www.newsfeed.com[/url] The #1 Newsgroup Service in the World! >100,000
    Newsgroups
    > ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
    =---


    Ray at Guest

  3. #3

    Default Re: How to open a file in the current directory

    Server.MapPath("config.xml")
    Otherwise the FSO object is usually based out of C:\<windows>\System32\


    --
    ----------------------------------------------------------
    Curt Christianson (Software_AT_Darkfalz.Com)
    Owner/Lead Designer, DF-Software
    [url]http://www.Darkfalz.com[/url]
    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------

    "Anonymous" <Nobody> wrote in message news:3f32cf11_6127.0.0.1...
    > Set fileSystem = Server.CreateObject( "Scripting.FileSystemObject" )
    > Set file = fileSystem.OpenTextFile( "config.xml", 1, False )
    >
    > It's saying that 'config.xml' doesn't exist. How can I reference this
    file?
    > It's in the same directory as the file with the above code. Do I need to
    > build the path somehow?
    >
    >
    >
    >
    > ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
    News==----
    > [url]http://www.newsfeed.com[/url] The #1 Newsgroup Service in the World! >100,000
    Newsgroups
    > ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
    =---


    Curt_C [MVP] Guest

Similar Threads

  1. How to get the full path of the current open PDF file?
    By yiyun0918@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 2
    Last Post: March 27th, 03:44 AM
  2. #39351 [NEW]: require and include fails to open file in current directory
    By lampiluoto at gmail dot com in forum PHP Bugs
    Replies: 17
    Last Post: April 3rd, 08:21 PM
  3. #25500 [NEW]: The directory of SQLite_open() use to open the file
    By o_gangrel at hotmail dot com in forum PHP Development
    Replies: 0
    Last Post: September 11th, 11:03 PM
  4. File > Open default directory.
    By Anthony MMTS in forum Macromedia Fireworks
    Replies: 3
    Last Post: August 25th, 03:26 PM
  5. Replies: 0
    Last Post: July 28th, 04:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139