/**
  * This method should be called after the GetUploadedFileName has returned the resultant
  * filename and the parent object has performed any necessary action on the filename.
  * This method will kill the processing of the page (if necessary).
  *
  * @param string $Message Success message to inject in the page
  * @param string $ResultPage Page to load in case of success
  * @return void the script will terminate
  */
 function CompleteUpload($Message = '', $ResultPage = '')
 {
     if (ForceIncomingString('PostBackAction', '') == $this->PostBackAction) {
         if ($this->Context->WarningCollector->Count() > 0) {
             // Change the contents of the container element to the specified message
             echo "<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\tvar Parent = window.parent.document;\n\t\t\t\t\t\t\tif (Parent) {\n\t\t\t\t\t\t\t\tvar Container = Parent.getElementById('" . $this->ContainerID . "_Errors');\n\t\t\t\t\t\t\t\tif (Container) {\n\t\t\t\t\t\t\t\t\tContainer.innerHTML = '" . $this->EncodeErrorMessage($this->Context->WarningCollector->GetMessages()) . "';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</script>\n\t\t\t\t\t</head>\n\t\t\t\t</html>";
         } elseif ($ResultPage == '') {
             // Change the contents of the container element to the specified message
             echo "<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\tvar Parent = window.parent.document;\n\t\t\t\t\t\t\tif (Parent) {\n\t\t\t\t\t\t\t\tvar Container = Parent.getElementById('" . $this->ContainerID . "');\n\t\t\t\t\t\t\t\tvar ResultContainer = Parent.getElementById('" . $this->ContainerID . "_Result');\n\t\t\t\t\t\t\t\tif (Container && ResultContainer) {\n\t\t\t\t\t\t\t\t\tContainer.style.display = 'none';\n\t\t\t\t\t\t\t\t\tResultContainer.innerHTML = '" . $Message . "';\n\t\t\t\t\t\t\t\t\tResultContainer.style.display = 'block';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</script>\n\t\t\t\t\t</head>\n\t\t\t\t</html>";
         } else {
             // Refresh the parent document
             echo "<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\tvar Parent = window.parent.document;\n\t\t\t\t\t\t\tif (Parent) {\n\t\t\t\t\t\t\t\tParent.location = '" . $ResultPage . "';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</script>\n\t\t\t\t\t</head>\n\t\t\t\t</html>";
         }
         $this->Context->Unload();
         die;
     }
 }