SDKsReact Native
Create file message from file
Construct a file message from a local filesystem path using the OpenIM React Native SDK.
Construct a file message from a local file on the device filesystem:
const message = await OpenIMSDK.createFileMessageFromFullPath({
filePath,
fileName: 'product-specification.pdf',
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
filePath | string | Yes | Absolute local filesystem path to the target file. |
fileName | string | Yes | Display filename presented in the message view. |
Return value
A resolved Promise returns the initialized MessageItem object with file metadata populated in fileElem.
This method builds the message structure strictly in client memory; it does not dispatch messages to the server or trigger lifecycle events. After initialization, invoke Send message to deliver it to a conversation; the SDK automatically uploads the local file during transmission.
Was this page helpful?