SetHTTPHeader

Description

Add a header to an http(s) post request. This header will be cleared every time an HTTPUpload/HTTPDownload request is done.

Syntax

.SetHTTPHeader(HeaderName, HeaderValue);

Parameters

<string> HeaderName: specifies the name of the header which can later be used on the server to retrieve the header value.
<string> HeaderValue: specifies the header value.

Return value

bool

true indicates success. false indicates failure.

When false is returned, check ErrorCode or ErrorString for error information.

Remarks

This method is valid only in HTML5 Edtion (Windows & Mac)

Example

JavaScript:

DWObject.SetHTTPHeader('dwt_CustomHeader','dynamsoft');
DWObject.HTTPUpload ('www.dynamsoft.com/SaveToFile.aspx?filename=001.pdf', [0,1], EnumImageType.PDF, 
EnumDWT_UploadDataFormat.BINARY, true, OnHttpUploadSuccess, OnHttpUploadFailure);
function OnHttpUploadSuccess (httpResponse) {
    console.log("HTTPResponseString: " + httpResponse);
}
 
function OnHttpUploadFailure (errorCode, errorString, httpResponse) {
    alert("ErrorCode: " + errorCode+ "ErrorString: " + errorString + "HTTPResponseString: " + httpResponse);
}