/ SDKs / Unity
SDKs
Chat SDKs Unity v4
Chat SDKs Unity
Chat SDKs
Unity
Version 4

Cancel an in-progress file upload

Copy link

Using the CancelUploadingFileMessage() method, you can cancel an in-progress file upload while it hasn't been completed yet. If the function operates successfully, the value of true is returned.

Note: If you attempt to cancel the upload after it has already been completed or canceled, or the attempt results in an error, the function returns the value of false.

SbFileMessageCreateParams fileMessageCreateParams = new SbFileMessageCreateParams(FILE);
SbFileMessage fileMessage = channel.SendFileMessage(fileMessageCreateParams, inProgressHandler: null, (inFileMessage, inError) =>
{
    if (inError != null)
        return; // Handle error.

    // Additional logic here, if necessary.
});

// Cancel uploading a file in the file message.
groupChannel.CancelUploadingFileMessage(fileMessage.RequestId);