Dim fso, MyFile
Set fso = server.CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("..\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
Thanks in advance,
Sean
Brian
"Sean" <no...@here.now> wrote in message news:38F52DE7...@here.now...
>I have the following in a directory. I would like to have it create a
>file in the following relative location. ie. up one level.
>
>Dim fso, MyFile
> Set fso = server.CreateObject("Scripting.FileSystemObject")
> Set MyFile = fso.CreateTextFile("..\testfile.txt", True)
> MyFile.WriteLine("This is a test.")
> MyFile.Close
You have to use a full filesystem path, not a relative URL, in
the FileSystemObject. Use Server.MapPath to convert the
relative path to a full one.
mdc
--------------------------
http://www.mc2studios.com/
BEGIN ERROR
"c:\inetpu\wwwroot\a1\test.asp
Microsoft VBScript runtime error '800a0046'
Permission denied
a1\test.asp, line 16 "
END ERROR
line 16 is the CreateTextFile line, and test.asp is the asp file that has
this block of code in it.
My question is, am I doing something wrong in my code to produce this
error, or is it a permission problem on the webserver as the error implies?
The reason that I ask is the webserver is maintained by someone else, and
he thinks that it is a fault in my code.
Any help would be greatly appreciated,
Sean
Below is my modified code to include the complete path:
Dim fso, MyFile
Set fso = server.CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\inetpu\wwwroot\a1\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
The webserver is NT4, SP6 running IIS4 if that matters.
Sean <no...@here.now> wrote in article <38F62C1F...@here.now>...
Sean