TWAIN ActiveX Control, Plug-in, Scanner SDK, Component, HTTP Control/SDK

Dynamsoft TWAIN Products

Support Community for TWAIN Control/Component/SDK for Scanning Solutions
* Login   * Register
* FAQ    * Search

It is currently Sun May 20, 2012 1:46 pm




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Browser hangs when clicking cancel on File Transfer
PostPosted: Tue Aug 09, 2011 6:28 am 
Offline

Joined: Mon Mar 28, 2011 7:19 am
Posts: 4
If a user cancels a File Transfer (HttpUpload*) the web browser hangs and becomes unresponsive. If the user waits long enough, they get the error message in the alert box (our code is below)

Is there anything we can do to catch the cancel event and handle it gracefully?

Code:
function UploadImage() {
   var CurrentPathName = unescape(location.pathname); // get current PathName in plain ASCII   
   var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") + 1);

   WebTwain3.IfSSL = window.location.protocol == "https:";
   if (WebTwain3.IfSSL) {
      WebTwain3.HTTPPort = 443;
   }
   
   var docFormat = GetSettings("Format", "PDF"); // default is pdf
   var docFileName = "ScannedDocument." + docFormat.toLowerCase();

   CopyToBufferForUpload();

   switch (docFormat) {
      case "JPG":
         WebTwain3.HTTPUploadThroughPost(strHostIP, 0, actionPage, docFileName);
         break;
      case "TIFF":
         WebTwain3.HTTPUploadAllThroughPostAsMultiPageTIFF(strHostIP, actionPage, docFileName);
         break;
      case "PDF":
      default:
         WebTwain3.HTTPUploadAllThroughPostAsPDF(strHostIP, actionPage, docFileName);
         break;
   }

   CopyToBufferForReturn();

   if ((WebTwain3.HTTPPostResponseString).length > 0) {
      
      var queryString = WebTwain3.HTTPPostResponseString + "&nodeId=" + GetQueryString("nodeId", "0") + "&ImagesLeft=" + (WebTwain3.HowManyImagesInBuffer - LastPage.innerHTML);

      queryString += "&isQuickFinder=" + IsQuickFinder();
      var quickFinderMultipleIndex = GetQueryString("QuickFinderMultipleIndex", "0");

      queryString += "&QuickFinderMultipleIndex=" + quickFinderMultipleIndex;
      self.location = "../Add-Document.aspx" + queryString;
   }
   else {
      var errorMessage = WebTwain3.ErrorString.indexOf('Success') == 0 ? '' : WebTwain3.ErrorString;
      alert("There was a problem uploading your scanned file(s). Please try again. If the problem persists, contact Support.\r\n" + errorMessage);
   }
}


Top
 Profile  
 
 Post subject: Re: Browser hangs when clicking cancel on File Transfer
PostPosted: Wed Aug 10, 2011 3:02 am 
Offline
User avatar

Joined: Tue Mar 08, 2005 12:23 am
Posts: 1075
Hi,

Thanks for your feedback. We’ve reproduced the problem on our side. When you attempt to cancel a file transfer, the application will close all the requests and this leads to the response latency that you are experiencing.

Our developers are now looking into this issue and hope we can find a better way to optimize the operation. I will keep you updated on this issue.

_________________
Catherine Sea
TWAIN Support Team
TWAIN ActiveX/Plug-in for Web Applications, Scanner COM Control
TWAIN .NET Component/SDK for Desktop Applications

Follow me @Twitter, Facebook
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

It is currently Sun May 20, 2012 1:46 pm


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Copyright © 2010 Dynamsoft Corporation. All Rights Reserved. | Knowledge Base | Source Control Blog