<body>
<form action=restore.asp method=post>
<select name=gettype>
<option value=replace>Replace
<option value=append>Append
</select><input type=submit>
</form>
<%
dim readall, gettype, result
result = "no select option and no work"
gettype = request.form("gettype")
if len(gettype) > 1 then
set ftxt=createobject("scripting.filesystemobject")
set ln = ftxt.opentextfile(server.mappath("/cgi-bin/searchbackup.dat"))
allrec = ln.readall
ln.close
end if
if gettype = "replace" then
set ln = ftxt.createtextfile(server.mappath("/cgi-bin/search.dat"),true)
result = "ok"
end if
if gettype = "append" then
set ln = ftxt.opentextfile(server.mappath("/cgi-bin/search.dat"),8,true)
result = "ok"
end if
if result = "ok" then
ln.write(allrec)
ln.close
end if
response.write "Process " & gettype & " : " & result
%>
</body>
จำนวน : 32 บรรทัด