Uploads images of specified indices in Dynamsoft image viewer to the HTTP server synchronously.

Syntax, indices, imageType [, httpMethod = EnumHttpMethod.POST, [dataFormat = EnumUploadDataFormat.BINARY]]);


<string> url: specifies the absolute path of the action page and file name (optional).
<int[]> indices: specifies the indices of images in buffer. The index is 0-based.
<EnumImageType> imageType: specifies the format of the file you want to upload as.

Image Type Enumerated Value
BMP EnumImageType.BMP
JPEG EnumImageType.JPEG
TIFF EnumImageType.TIFF
PNG EnumImageType.PNG
PDF EnumImageType.PDF

<EnumHttpMethod > optional httpMethod: specifies the uploading method, either EnumHttpMethod.POST or EnumHttpMethod.PUT.
<EnumUploadDataFormat> optional dataFormat: specifies the data format, either EnumUploadDataFormat.BINARY or EnumUploadDataFormat.BASE64.

Return value


true indicates success. false indicates failure.

When false is returned, please check getErrorCode() or getErrorString() and getHTTPResponse() for error information.


EnumImageType, EnumHttpMethod and EnumUploadDataFormat is under namespace io.

If imageType is EnumImageType.BMP/JPEG/PNG, the length of indices must be 1.

EnumHttpMethod.PUT is not supported in version 5.0 and 5.1.

For IE 9 or lower, even if you set data format to EnumUploadDataFormat.BINARY, this setting will be ignored and the image will be automatically uploaded as BASE64 format.


var imageviewer = DCSObject.getImageViewer("******");  // Get a specified image viewer'', [0,1],,,;

See also