Browse SDKs · React Native
SDKsReact Native

Create a file message from a file

OpenIM React Native SDK guide for create a file message from a file.

Copy

Use createFileMessageFromFullPath() to create a message from a file on the device.

const message = await OpenIMSDK.createFileMessageFromFullPath({
  filePath,
  fileName: 'product-guide.pdf',
});

Parameters

ParameterTypeRequiredDescription
filePathstringYesFull path to the file.
fileNamestringYesFile name shown to recipients.

The call returns a MessageItem ready to send. When you use Send a message, the SDK uploads the local file.