vbscript - How to create a new text file with asp? -
im trying write programme create new text file asp. giving microsoft vbscript runtime error '800a0035'. when alter file line
set f=fs.getfile("c:\vie4.txt") to existing file not give error.
hello !
welcome web site!
microsoft vbscript runtime error '800a0035'
file not found
/simple2.asp, line 33
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" method ="post" action = "simple2.asp" runat="server" > <div> <input id="text1" type="text" value = "fname" /> <input id="text2" type="text" value ="lname" /> </div> </form> <% response.write(request.querystring("fname")) response.write(" " & request.querystring("lname")) fname = request.querystring("fname") lname = request.querystring("lname") response.write("<p>hello " & fname & " " & lname & "!</p>") response.write("<p>welcome web site!</p>") dim fs,f set fs=server.createobject("scripting.filesystemobject") set f=fs.getfile("c:\vie4.txt") response.write("file created: " & f.datecreated) set f=nothing set fs=nothing %> </body> </html>
when in doubt, read documentation. getfile doesn't create files. utilize createtextfile that:
... filename = "c:\vie4.txt" if not fs.fileexists(filename) fs.createtextfile filename set f = fs.getfile(filename) ... vbscript asp-classic
No comments:
Post a Comment