How to Open a file in ASP
I don't know how to open a file in ASP. Here is my code which is not working.
<%
Dim vid_file
vid_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vid.dat"
Dim vkey_file
vkey_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vkey.dat"
dim fp1,f
set fp1 = Server.CreateObject("Scripting.FileSystemObject")
set f=fp1.OpenTextFile(Server.MapPath("vid_file"),8,true)
f.WriteLine("This text will be added to the end of file")
f.Close
set f=Nothing
set fp1=Nothing
'Single Variable Declarations
dim fp2,f2
set fp2 = Server.CreateObject("Scripting.FileSystemObject")
'fExists=FileSysObj.FileExists(vid_file)
s开发者_StackOverflowet f2=fp2.OpenTextFile(Server.MapPath("vkey_file"),8,true)
'set TextStreamObj = fp2.OpenTextFile(vkey_file,1,true)
'TextStreamObj.WriteLine("This text will be added to the end of file")
f2.WriteLine("This text will be added to the end of file")
f2.Close
set f2=Nothing
set fp2=Nothing
%>
<%
Dim vid_file
vid_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vid.dat"
Dim vkey_file
vkey_file = Request.ServerVariables("APPL_PHYSICAL_PATH")& "cannon\pay\vkey.dat"
dim fp1,f
set fp1 = Server.CreateObject("Scripting.FileSystemObject")
set f=fp1.OpenTextFile(vid_file,8,true)
f.WriteLine("This text will be added to the end of file")
f.Close
set f=Nothing
set fp1=Nothing
'Single Variable Declarations
dim fp2,f2
set fp2 = Server.CreateObject("Scripting.FileSystemObject")
'fExists=FileSysObj.FileExists(vid_file)
set f2=fp2.OpenTextFile(vkey_file,8,true)
'set TextStreamObj = fp2.OpenTextFile(vkey_file,1,true)
'TextStreamObj.WriteLine("This text will be added to the end of file")
f2.WriteLine("This text will be added to the end of file")
f2.Close
set f2=Nothing
set fp2=Nothing
%>
精彩评论