Click to See Complete Forum and Search --> : Permission problems with FileSystemObject


svsameer
02-02-2005, 06:43 AM
Hi i am

set fs=Server.CreateObject("Scripting.FileSystemObject")
fcopy1=server.mappath("index_3.asp")
set t=fs.OpenTextFile(fcopy1,1,false)
x=t.ReadAll
t.close
'Response.Write("The text in the file is: " & x)
fcopy2=server.mappath("../site/samnik/content/index_3.asp")
set f=fs.CreateTextFile("fcopy2")
f.write(x)
Response.Write("<hr><a href=../site/samnik/content/index_3.asp>file is created</a>")
f.close

svsameer
02-02-2005, 06:45 AM
the above code is giving me error


Microsoft VBScript runtime error '800a0046'

Permission denied

but the script is creating the folder

and not copying the file

russell
02-02-2005, 06:54 AM
is it this line that generates the error?

set f=fs.CreateTextFile("fcopy2")

if so:

try changing to:

set f=fs.CreateTextFile("fcopy2.asp") ' or some other extension
OR
set f=fs.OpenTextFile("fcopy2.asp, 2, true")

finally, u may need to check the permissions on the parent directory to the one u are creating: soes it allow write access? is it set for child directories to inherit all permissions?