Forum Moderators: open

Message Too Old, No Replies

ASP and FSO

         

ColinJ

12:11 pm on Jan 15, 2003 (gmt 0)

10+ Year Member



Gidday All,

I have uploaded this script to my host and when i run it I get this error

Scripting.FileSystemObject.1 error '80070005'

You are not permitted to access a file which is not located within your ASP application's root.

What directory do you think they might be referring too?

Any help appreciated

Thank You
Colin

<code>
Const fsoForAppend = 8

Dim Stuff, myFSO, WriteStuff

'this is what we will write in the file

Stuff = ""
Stuff = Stuff & dateTimeStamp & ","
Stuff = Stuff & dictFields.Item( "SelectCity" ) & ","
Stuff = Stuff & dictFields.Item( "Workshop1" ) & ","
Stuff = Stuff & dictFields.Item( "Workshop2" ) & ","
Stuff = Stuff & dictFields.Item( "Salutation" ) & ","
Stuff = Stuff & dictFields.Item( "FirstName" ) & ","
Stuff = Stuff & dictFields.Item( "LastName" ) & ","
Stuff = Stuff & dictFields.Item( "Title" ) & ","
Stuff = Stuff & dictFields.Item( "CompanyName" ) & ","
Stuff = Stuff & dictFields.Item( "CompanyAddress" ) & ","
Stuff = Stuff & dictFields.Item( "Suburb" ) & ","
Stuff = Stuff & dictFields.Item( "PostCode" ) & ","
Stuff = Stuff & dictFields.Item( "PhoneNumber" ) & ","
Stuff = Stuff & dictFields.Item( "Mobile" ) & ","
Stuff = Stuff & dictFields.Item( "EmailAddress" ) & VbCrLf

Response.write Stuff

'this line creates an instance of the File Scripting Object named myFSO
Set myFSO = Server.CreateObject("Scripting.FileSystemObject")

'this line opens the file, notice the 8, it will cause the script to append to the file
Set WriteStuff = myFSO.OpenTextFile( "/home/bdweb8083m/johnstonefamily/public_html/participants.txt", fsoForAppend, True)

'this line actually writes STUFF from above to the file
WriteStuff.WriteLine Stuff

'this line closes the file
WriteStuff.Close

'this line destroys the instance of the File Scripting Object named WriteStuff
SET WriteStuff = NOTHING

'this line destroys the instance of the File Scripting Object named myFSO
SET myFSO = NOTHING

</code>

wardbekker

12:20 pm on Jan 15, 2003 (gmt 0)

10+ Year Member



Hi CollinJ

You should use Server.Mappath("participants.txt"). ASP wants the drive letter also ;-)

Good Luck!

Ward

ColinJ

12:34 pm on Jan 15, 2003 (gmt 0)

10+ Year Member



Silly me the problem was in the path. I fixed it!