Dynamic Web TWAIN: How to pass information back from the server after upload

In Dynamic Web TWAIN We have an API HTTPPostResponseString which can be used to get the response string given from the server after uploading a file.

Because of the way Dynamic Web TWAIN is programmed to interpret responses from the server any response will be treated as a failure and will trigger the OnFailure function. Because of this any time you are using the HTTP response string to pass data back any message handling must be directed through the OnFailure callback function.

Filtering Messages and Errors from the server

Once the OnFailure callback function is triggered it is recommended that you use some string parsing to check the returned message and see if it is infact an error message returned or some other message with important information.

Once the message type has been discovered you may decide if an error message should appear or if some other behaviour is necessary.

You may also use the following code to check whether or not the scan was a success:

Response.Write("DWTUploadSuccess:" + "Success");

DWObject.HTTPUploadAllThroughPostAsMultiPageTIFF(location.hostname, '/Scanner/ScannerUpload', val); 
if(DWObject.HTTPPostResponseString.indexOf('DWTUploadSuccess') != -1){ 
alert(DWObject.HTTPPostResponseString.substr(17)); //This will show 'Success' 
}
Is this page helpful?

Leave a Reply

Your email address will not be published.