%@ Language=VBScript %>
<% Option Explicit %>
<% Response.Buffer = TRUE %>
<% '-------------------------------------------------------------------------
' File Upload Template Example code
' Copyright (c) Microsoft Corporation. All rights reserved.
'---------------------------------------------------------------
%>
<%
Dim bIsPost
Dim F_FileName
Server.ScriptTimeout = 3600
bIsPost = CInt(Request.QueryString("IsPost"))
If bIsPost Then
'
' Perform file post processing.
'
OnPostFile()
Else
'
' Perform first time processing. File is not being posted
' during first time processing.
'
OnFirstTime()
End If
Function OnFirstTime()
WriteLine("")
WriteLine("")
WriteLine("
")
Call EmitFileSelectionForm()
WriteLine("")
WriteLine("")
End Function
Function OnPostFile()
Dim sFileName
Dim sUploadPath
Dim iFileSize
WriteLine("")
WriteLine("")
WriteLine("")
Call EmitFileSelectionForm()
WriteLine("")
WriteLine("")
WriteLine("")
WriteLine("You selected file: "+ Server.HTMLEncode(sUploadPath + sFileName))
WriteLine(" | ")
WriteLine("
")
WriteLine("
")
Else
sFileName = ""
End If
WriteLine("")
WriteLine("File upload did not complete, unexpected error during upload.")
WriteLine("
")
WriteLine("Error code: " + CStr(Hex(Err.Number)) + " " + CStr(Err.Description))
WriteLine("
")
Exit Function
End If
sFileName = oFileUpload.FileName
If ( Err.Number <> 0 ) Then
Post_UploadFile = FALSE
Set oFileUpload = nothing
SA_TraceOut "TEMPLATE_FILE_POST", "Unexpected error getting filename, error: " + CStr(Hex(Err.Number))
WriteLine("")
WriteLine("File upload did not complete, unable to query file name.")
WriteLine("
")
WriteLine("Error code: " + CStr(Hex(Err.Number)) + " " + CStr(Err.Description))
WriteLine("
")
Exit Function
End If
iFileSize = oFileUpload.FileSize
If ( Err.Number <> 0 ) Then
Post_UploadFile = FALSE
Set oFileUpload = nothing
SA_TraceOut "TEMPLATE_FILE_POST", "Unexpected error getting file size, error: " + CStr(Hex(Err.Number))
WriteLine("")
WriteLine("File upload did not complete, unable to query file size.")
WriteLine("
")
WriteLine("Error code: " + CStr(Hex(Err.Number)) + " " + CStr(Err.Description))
WriteLine("
")
Exit Function
End If
Set oFileUpload = nothing
End Function
Function EmitFileSelectionForm()
WriteLine("