Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Reading a file from my server folder

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62978
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Reading a file from my server folder
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Reading a file from my server folder - 7/31/2008 12:10:32 AM   
  bni2

 

Posts: 4
Score: 0
Joined: 7/29/2008
Status: offline
I have been working for about a month now trying to read a text file I have in my
web space on my server (GoDaddy if that helps).  I have been very unsuccessful.
Rather than ask for help fixing my script, could someone please suggest some simple code
that I can upload to my server that will read a text file named sched.txt.  This will, at least,
prove to me that I have the ability to read from a file.  Thank you.
 
 
Post #: 1
 
 RE: Reading a file from my server folder - 7/31/2008 2:35:22 AM   
  ninjamaster

 

Posts: 107
Score: 0
Joined: 1/23/2007
Status: offline
It's amazing what Google will give you :p


Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = objFSO.OpenTextFile ("\\SERVERNAME\FOLDERPATH\FILENAME.txt", ForReading)
strContents = objTextFile.ReadAll
objTextFile.Close

Wscript.Echo strContents

(in reply to bni2)
 
 
Post #: 2
 
 RE: Reading a file from my server folder - 7/31/2008 3:08:26 AM   
  bni2

 

Posts: 4
Score: 0
Joined: 7/29/2008
Status: offline
Thank you for you help ninjamaster.  I tried your code in my web page and nothing
happened.  So I put message boxes in between lines of code to see how much of the script
it was parsing.  The message box before the CreateObject worked, but that was it.  I also wasn't
sure what to put in for SERVERNAME (I used GoDaddy) and FOLDERPATH (I used root).  Where
do you get these values from?  Could this be why it didn't work or is the script not even getting
this far?  Hope you can help, thanks.

(in reply to ninjamaster)
 
 
Post #: 3
 
 RE: Reading a file from my server folder - 7/31/2008 3:12:27 AM   
  ninjamaster

 

Posts: 107
Score: 0
Joined: 1/23/2007
Status: offline
Where is the physical location of the file?

The website is GoDaddy but is that the name of your server that the website runs on?

Simple test. Dump the text to the root of your PC and rewrite the code to point to that file. Once that works you know that reading the file works.

Then change the code to point to the location of the file on your server.

:)

(in reply to bni2)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Reading a file from my server folder Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts