In order to close the progress indicator popup window, it is necessary to call the Window.Close() method on the child window when the transfer has completed. When using the visual upload control, the transfer complete event handler is:
AXFFile_OnTransferComplete
In order for the Window.Close() method to have any effect, it must be called from an object reference to the child window. In order to create this object, declare a global variable and then set it equal to the result of the Window.Open() method. Once you have this reference, call the Close method from within the OnTransferComplete event handler.
Example client-side VBScript code can be found below.
<SCRIPT language="VBScript">
'--- Create global variable that will reference the popup window
dim oWin
'--- Disable the Reset button
document.all("ResetButton").Disabled = True
'--- Here XFile is being initialized when it is loaded
'--- The AXFFile visual control contains an instance of XFRequest which
'--- is the main transfer engine. Set XFRequest property CurrentUrl
'--- That URL is where the upload will be sent to
AXFFile.XFRequest.CurrentUrl = "http://MyServer/MyUploadApplication/uploadprocess.asp"
'--- Files can be added to the AXFFile upload queue by clicking "Add File" in the control
'--- or programmatically by calling the AddFile method
AXFFile.AddFile "C:/SomeDirectory/myfile.txt"
'--- Call the MakeWindow() function when the upload button is clicked
Sub UploadBtn_OnClick()
MakeWindow()
End Sub
'--- Reset XFile when the reset button is clicked
Sub ResetButton_OnClick
AXFFile.Reset
document.all("UploadBtn").Disabled = False
End Sub
'--- Once the transfer is complete, the OnTransferComplete event will fire. When this happens,
'--- Call the CloseWindow() function to close the popup window
Sub AXFFile_OnTransferComplete()
CloseWindow()
End Sub
'--- Create the progress indicator's popup window
Private Function MakeWindow()
If (AXFFile.Count > 0) Then
winstyle="height=300,width=400,status=no,toolbar=no,menubar=no,location=no"
set oWin = window.open("AXFFileProgress.asp","ProgressIndicator",winstyle)
document.all("UploadBtn").disabled = True
Else
MsgBox "There are no files to upload."
End If
End Function
'--- Close the progress indicators popup window
Private Function CloseWindow()
oWin.close()
End Function
</SCRIPT>
|