<%
' receives data (xml from flash)
' 1: back-up currently active quiz ( old/carrotquiz.xml )
' 2: make newly editted quiz active ( carrotquiz.xml )
' 3: archive today's latest version (eg: old/20010225.xml )
' 4: displays xml in a browser window
Option Explicit
Dim xmldom
Dim XMLstr
' xmldom = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmldom = Server.CreateObject("MSXML.DOMDocument")
xmldom.load(Request)
XMLstr=xmldom.xml
If IsEmpty( xmldom) Then
Response.Write "This sucks"
' Response.Flush
If IsEmpty( Request.Form("xml")) Then
Response.Status = 412
Response.End
Else
Dim fs
Dim filename
Dim backname
Dim thisfile
Response.ContentType="text/xml"
Response.Write Request.Form("xml")
filename = server.mappath( "carrotquiz.xml" )
Set fs = CreateObject("Scripting.FileSystemObject")
backname = server.mappath( "old/carrotquiz..xml")
Set thisfile= fs.GetFile( filename )
thisfile.Copy( backname )
Set thisfile= fs.OpenTextFile(filename,2,True)
thisfile.write( Request.Form("xml") )
thisfile.close
backname = server.mappath( "old/" & Year(Date()) &
Month(Date()) & Day(Date()) & ".xml")
Set thisfile= fs.GetFile( filename )
thisfile.Copy( backname )
Set thisfile = Nothing
Set fs = Nothing
End if
Else
Response.Write "Look I found it!"
Response.Write XMLstr
End if
%>