uploadAsync()

Description

Uploads images asynchronously. The selected image data in DcsBuffer will be encoded according to the value of encodeParameter and uploaded to the specified HTTP server.

Syntax

- (void) uploadAsync: (NSArray *)indices
uploadConfig: (DcsHttpUploadConfig *) config
encodeParameter: (DcsEncodeParameter *) parameter
successCallback: (onUploadSuccess) onSuccess
failureCallback: (onUploadFailure) onFailure
progressUpdateCallback:(onUploadProgress) onProgress

Parameters

indices:NSArray The indices of images to be uploaded.
config:DcsHttpUploadConfig Configuration for HTTP upload.
parameter:DcsEncodeParameter Its value will be chosen from DcsPNGEncodeParameter, DcsJPEGEncodeParameter or DcsPDFEncodeParameter which represents to save the images as PNG, JPG or PDF files.
onSuccess:onUploadSuccess The callback function when this method performs successfully.
onFailure:onUploadFailure The callback function when this method performs unsuccessfully.
onProgress:onUploadProgress The callback function when this method pushes load progress information.

Return value

Void

Remarks

encodeParameter Maximum Value Result if the length of indices exceeds the maximum value
DcsPNGEncodeParameter 1 Upload the first image as a PNG file.
DcsJPEGEncodeParameter 1 Upload the first image as a JPG file.
DcsPDFEncodeParameter no limit Upload the images as a multi-page PDF.

Exceptions

Circumstance Exception thrown
License verification failed. DcsLicenseVerificationFailedException
Upload fails due to the network issue. DcsHttpErrorException
No network connection. DcsNetworkDisconnectedException
Indices/encodeParameter/file is nil. DcsValueNotValidException
Indices include a value not smaller than DcsBuffer.count. DcsValueOutOfRangeException
void (^onUploadSuccess) (NSData *data)
Description This event is triggered when uploadAsync function is successfully executed.
Parameter data: The returned data message when uploadAsync function is successfully executed.
void (^onUploadFailure) (id userData, DcsException *exception)
Description This event is triggered when uploadAsync function is not successfully executed.
Parameter exception: The exception uploadAsync throws.
BOOL (^onUploadProgress) (NSInteger progress)
Description This event is triggered when uploadAsync function is executing and showing the progress.
Parameter progress: The progress of uploading.
Return When YES is returned, uploadAsync will keep executing. When NO is returned, uploadAsync will stop.
Is this page helpful?

Leave a Reply

Your email address will not be published.