Dynamsoft Home|Product Home

HTTPUploadAllThroughPostAsMultiPageTIFF Method

Description

Uploads all images in buffer to the HTTP server through HTTP Post method as Multi-Page TIFF.

Syntax

Boolean ObjectName. HTTPUploadAllThroughPostAsMultiPageTIFF(String HTTPServer, String ActionPage, String FileName)

Parameters

String HTTPServer: the name of the HTTP server.

String ActionPage: the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". This is the page corresponds to the action in <form> html tag: <form id = "frmSample" action = "upload.asp" method = post>...</form>

String FileName: the name of the image to be uploaded.

Return value

Boolean.

TRUE indicates success. FALSE indicates failure.

When an error occurs and IfThrowException property is TRUE, an exception will be thrown.

When FALSE is returned or an exception is thrown, check ErrorCode property and ErrorString property for error information.

Remarks

The field name of the uploaded image is RemoteFile.

IMPORTANT: Dynamic Web TWAIN uses a special way to see if an image is uploaded and processed successfully by server. If the server returns 0 bytes, indicates success. Otherwise, indicates failure. In other words, when the uploaded image is processed successfully, the action page on the server should not return anything, even the "<HTML>".

See also

FTPUserName property, FTPPassword property, FTPPort property, ProxyServer property, FTPDownload(), FTPUpload(), HTTPPort property, IfSSL property, HTTPUserName property, HTTPPassword property, HTTPDownload(),, HTTPUploadThroughPost(), HTTPUploadThroughPut(), HTTPUploadAllThroughPutAsMultiPageTIFF(), FTPUploadAllAsMultiPageTIFF()

Sample

A simple ASP.NET (C#) sample is provided. Should you need sample in other languages, please access the following page to download samples.
https://www.dynamsoft.com/Secure/RegisterInfo_sample.aspx

ASP.NET (C#) Sample:

Snippet in Scan.aspx:
...

<script language="javascript">
function btnScan_onclick() 
{
	frmScan.DynamicWebTwain1.SelectSource();
	frmScan.DynamicWebTwain1.OpenSource();
	frmScan.DynamicWebTwain1.MaxImagesInBuffer = 4; //Trial version can only hold 4 images in buffer
	frmScan.DynamicWebTwain1.AcquireImage();
}
function btnUpload_onclick() 
{
	var strActionPage;
	var strHostIP;

	var CurrentPathName = unescape(location.pathname); // get current PathName in plain ASCII 
	var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") + 1); 
	strActionPage = CurrentPath + "SaveToFile.aspx"; //the ActionPage's file path

	strHostIP = "localhost"; //The host's IP or name 

	frmScan.DynamicWebTwain1.HTTPPort = 80; 
	frmScan.DynamicWebTwain1.HTTPUploadAllThroughPostAsMultiPageTIFF(strHostIP,strActionPage,"imageData.tif");

	if (frmScan.DynamicWebTwain1.ErrorCode != 0)
		alert(frmScan.DynamicWebTwain1.ErrorString);
	else //succeded
		alert("Upload successfully");
} 
</script>

...

SaveToFile.aspx:
<%@ Page Language="c#" AutoEventWireup="false" Debug="True"%>

<%
	HttpFileCollection files = HttpContext.Current.Request.Files;
	HttpPostedFile uploadfile = files["RemoteFile"];
	uploadfile.SaveAs(System.Web.HttpContext.Current.Request.MapPath(".") + "/" + uploadfile.FileName);
%>