Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of FileSystemObject TextStream

Status
Not open for further replies.

nazzaro

Programmer
Jun 28, 2000
31
US
I'm having trouble using the following VbScript (example straight from MS VbScript site):


Set fso = CreateObject("Scripting.FileSystemObject")

Set MyFile = fso_OpenTextFile("c:\upload\testfile.txt", ForWriting, True)

MyFile.WriteLine "Hello world!"

MyFile.WriteLine "The quick brown fox"

MyFile.Close

Set MyFile = fso_OpenTextFile("c:\upload\testfile.txt", ForReading)

ReadLineTextFile = MyFile.ReadLine ' Returns "Hello world!"

MyFile.Close

I'm getting an "invalid procedure call or argument" error on the fso_OpenTextFile line. Permissions on c:\upload on the web server are set to "Full" for everyone (for testing). The Persits AspUpload component has no trouble uploading files to c:\upload. Actually, I'm trying to read the uploaded files, but since I ran into the problem, I tried the above code to see if it worked. It doesn't matter whether I try to open a TextStream object for read or write, I get the same error.

Any clues?
[sig][/sig]
 
did you make sure to load the include files, that holds the constants for the ForReading, and ForWriting, otherwise it doesnt know what those values are. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Thanks, that was the problem. [sig][/sig]
 
Yea I forgot about that, it isnt until IIS5 they decided to let it be just CreateObject. Something about not being able to free it out of memeory, or some other problem as that. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top