Skip to main content

uploadFile

Feature Introduction

Description

Upload a file via the SDK.

Function Prototype


- (void)uploadFile:(NSString *)fullPath
name:(NSString * _Nullable)name
cause:(NSString * _Nullable)cause
onProgress:(OIMUploadProgressCallback)onProgress
onCompletion:(OIMUploadCompletionCallback)onCompletion
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure;

Input Parameters

Parameter NameParameter TypeMandatoryDescription
fullPathNSStringYesFull path of the file on device
causeNSStringNoFile category
nameNSStringNoFile name

Return Value

NameTypeDescription
onProgressNSIntegerUpload progress
onCompletionOIMUploadCompletionCallbackUpload completion
onSuccessOIMSuccessCallbackSuccessful return
onFailureOIMFailureCallbackFailed return

Code Example


[OIMManager.manager uploadFile:@""
name:nil
cause:nil
onProgress:^(NSInteger saveBytes, NSInteger currentBytes, NSInteger totalBytes) {

} onCompletion:^(NSInteger totalBytes, NSString * _Nonnull url, NSInteger putType) {

} onSuccess:^(NSString * _Nullable data) {

} onFailure:^(NSInteger code, NSString * _Nullable msg) {

}];