繁体   English   中英

Sendbird发送图像文件

[英]Sendbird send image file

我正在阅读SendbirdJavaScript文档 ,尽管有发送文件的方法,但没有解释每个参数必须是什么或不同的选项。

channel.sendFileMessage(FILE, FILE_NAME, FILE_TYPE, FILE_SIZE, CUSTOM_DATA, function(message, error){
    if (error) {
        console.error(error);
        return;
    }
    console.log(message);
});

我发现了这个stackoverflow问题 ,这我有一定帮助,但我仍然无法发送文件。

有人能够使用JavaScript使用sendbird发送图像吗? 我正在寻找有关多个可用选项的有效JS示例和/或文档。

要发送文件消息,您只需要函数中的参数之一,即定义源的参数。 基本参数不需要其他参数。

channel.sendFileMessage(File, function(message, error) {
  if (error) {
    console.log(error);
    return;
  }

对于源文件,您只需要在本地或全局定义它的路径即可。 希望对您有所帮助。

这是一个有用的链接: https : //github.com/smilefam/SendBird-JavaScript/blob/master/react-native-sample/SendBirdReactNativeSample/src/pages/chat.js

在React Native中,您应该传递类似

{ uri: 'file://p/q/a.jpg' name: 'a.jpg' type: 'image/jpg' }

sendFileMessage方法。

这是您应该查看的示例代码。

https://github.com/smilefam/SendBird-JavaScript/blob/master/react-native-sample/SendBirdReactNativeSample/src/pages/chat.js#L178

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM