HTTPDownloadEx()

Description

Downloads an image from the HTTP server.

Syntax

.HTTPDownloadEx(hTTPServer, hTTPRemoteFile, imageType, [optionalAsyncSuccessFunc, optionalAsyncFailureFunc]);

Parameters

<string> hTTPServer: specifies the HTTP server.
<string> hTTPRemoteFile: specifies the path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client.
EnumDWT_ImageType (int) imageType: specifies the format.


Type Numeric Value
IT_BMP 0
IT_JPG 1
IT_TIF 2
IT_PNG 3
IT_PDF 4

The following two parameters are optional. If either one exists or both exist, the method is asynchronous, otherwise it's synchronous.

<OnSuccess function> optional optionalAsyncSuccessFunc: callback function triggered when the file is downloaded successfully.
<OnFailure function> optional optionalAsyncFailureFunc: callback function triggered when the file failed to be downloaded.

Please refer to the function prototype OnSuccess or OnFailure.

Return value

Only valid when used synchronously.

bool

true indicates success. false indicates failure.

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

Remarks

If you want to use this method to upload / download files through HTTPS, please don't forget to set IfSSL to true and set the correct HTTPPort.

Example

/****Get image01.png from: http://www.dynamsoft.com/images/image01.png****/
DWObject.HTTPDownloadEx('www.dynamsoft.com','/images/image01.png',3);
/**Get image02.jpg from: http://www.dynamsoft.com/images/GetImage.aspx?Index=2&amp;Name=image02.jpg**/
DWObject.HTTPDownloadEx('www.dynamsoft.com', '/images/GetImage.aspx?Index=2&amp;Name=image02.jpg',1);