Forum Moderators: open
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Filename = Server.MapPath("data\file.txt")
set fs = Server.CreateObject("Scripting.FileSystemObject")
set f = fs.OpenTextFile(Filename, ForReading)
I have set the data directory, through the Internet Services Manager, to have Read and Write permissions, with Script permissions set to none. What's really driving me crazy is it won't cause an error, just hang the browser indefinately. Even more annoying is that this does work and returns true when the file exists:
if fs.FileExists(Filename)
Its times like these I wish I wasn't so used to using M$ crap.
If you are using classic ASP then IUSR_machinename will need the read rights, if it's .NET then the ASPNET user will need them.
Const ForReading = 1, ForWriting = 2, ForAppending = 8Filename = Server.MapPath("data\messages.txt")
set fs = Server.createObject("Scripting.FileSystemObject")if not request.form("update") = "" then
if fs.FileExists(Filename) then
set f = fs.OpenTextFile(Filename, ForWriting)
else
set f = fs.CreateTextFile(Filename, true)
end if
f.write request.form("messages")
set f = nothing
end ifif fs.FileExists(Filename) then
set f = fs.OpenTextFile(Filename, ForReading)
messages = f.readall()
end ifset f = nothing
set fs = nothing
I think I'm just going to have to set the permissions on the file itself, as thats what I had to do for a database. I havn't tried this yet I just got back in.
<pre> tag is a bit screwy here :/ Of all places!