# How would I go about sending a file message with multiple images?

**URL:** <https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172>\
**Category:** JavaScript\
**Tags:** chatsdk\
**Created:** [October 21, 2020, 12:46pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172 "2020-10-21T12:46:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamKK](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@SamKK](https://community.sendbird.com/u/SamKK)\
**Post date:** [October 21, 2020, 12:46pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/1 "2020-10-21T12:46:05Z")

</div>

Lets say we have the standard “FileMessage” displayed like this in our cha, for this we use the “file.url” parameter. If I only wanted to send one message but attach multiple images. Is there a specific way of doing this? Or would I just attach the additional images to “data”?

![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/99eb77015af3032e33661e37cd3043d27d5ab4dc.png)

Imagine this card, but with maybe 2-3 additional images inside, kind of like facebook messenger.

We’re just using the Sendbird JS SDK + VueJS, not the React UI kit for clarity

Thanks,  
Sam

---

<div class="post-metadata">

**Author:** ![walter.rodriguez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/walter.rodriguez/32/546_2.png) [@walter.rodriguez](https://community.sendbird.com/u/walter.rodriguez)\
**Post date:** [October 21, 2020, 1:29pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/2 "2020-10-21T13:29:15Z")

</div>

You can send one file message.  
What you can do is to send URLs and parse the message to display your images.

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 11, 2021, 5:34pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/3 "2021-05-11T17:34:53Z")

</div>

and what about the local file choosing from library?  
as far as i know that, send bird will not response the uploaded images if you upload with urls file

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [May 11, 2021, 5:37pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/4 "2021-05-11T17:37:07Z")

</div>

You would simply select multiple items from the library you’re using to select the files. For example, if you were using the built in browser method, you’d select shift ctrl/cmd click multiple items.

Can you expand on what you mean by Sendbird not responding if you send multiple URLs?

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 11, 2021, 5:41pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/5 "2021-05-11T17:41:42Z")

</div>

could you share the doc guide for javascript ? i would be very appreciated

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [May 11, 2021, 5:48pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/6 "2021-05-11T17:48:09Z")

</div>

We don’t provide documentation on how to grab files from your device. We do provide documentation on how to send those files once you’ve selected them:

> **[Group channel | Chat JavaScript SDK | Sendbird Docs](https://sendbird.com/docs/chat/v3/javascript/guides/group-channel#2-send-a-message)**
>
> Learn about the features of a group channel.

Additionally, you can take a look at any of our sample applications to see how we may be implementing it in those: [GitHub - sendbird/SendBird-JavaScript: A guide of the installation and functions of Sendbird Chat, UIKit, and SyncManager for JavaScript samples.](https://github.com/sendbird/SendBird-JavaScript)

---

<div class="post-metadata">

**Author:** ![Miyoung\_Han](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/miyoung_han/32/183_2.png) [@Miyoung\_Han](https://community.sendbird.com/u/Miyoung_Han)\
**Post date:** [May 11, 2021, 5:51pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/7 "2021-05-11T17:51:37Z")

</div>

You can send multiple file messages via

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/d/d254da373d99b41287035119476d4c497dc984d9.png)

Please refer to our API reference  
[https://sendbird.github.io/core-sdk-javascript/module-model\_baseChannel-BaseChannel.html#sendFileMessage](https://sendbird.github.io/core-sdk-javascript/module-model_baseChannel-BaseChannel.html#sendFileMessage)

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 11, 2021, 5:52pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/8 "2021-05-11T17:52:07Z")

</div>

i will try again thanks @Tyler

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 11, 2021, 5:57pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/9 "2021-05-11T17:57:51Z")

</div>

thank you @Miyoung_Han

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 13, 2021, 4:01pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/10 "2021-05-13T16:01:14Z")

</div>

Hello there, when I call sendFileMessages() it’s doens’t respond anything

---

<div class="post-metadata">

**Author:** ![walter.rodriguez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/walter.rodriguez/32/546_2.png) [@walter.rodriguez](https://community.sendbird.com/u/walter.rodriguez)\
**Post date:** [May 14, 2021, 8:56am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/11 "2021-05-14T08:56:33Z")

</div>

This should work. You need to send multiple `sb.FileMessageParams()`

Start with your input box accepting multiple files. Something like:

```auto
<input type="file" id="filesEle" multiple />

```

Then, in your Javascript code:

```auto
const files = document.getElementById('filesEle').files;

```

To get the array of files. Then create as many `FileMessageParams()` as files selected:

```auto
// You need to send this array
const arrayParams = [];
// Check all the selected files
for (let file of files) {
  const params = new sb.FileMessageParams();
  params.file = file;
  params.fileName = file.name;
  params.fileSize = file.size;
  params.mimeType = file.type;
  // Add to the array
  arrayParams.push(params);
} 
// Send your message
channelObj.sendFileMessages(arrayParams, (fileMessage, error) => {
  ...
});    

```

Please let us know how it goes 🙂

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 14, 2021, 1:08pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/12 "2021-05-14T13:08:22Z")

</div>

yeah man, Sorry my bad, Function sendFileMessages doesn’t return call back, but when I refresh, still got uploaded image

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [May 14, 2021, 5:26pm UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/13 "2021-05-14T17:26:47Z")

</div>

Can you share with us your entire function for sending a file message? It should definitely return a callback.

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 15, 2021, 3:11am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/14 "2021-05-15T03:11:29Z")

</div>

![Screen Shot 2021-05-15 at 10.09.44](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/a/a7e490d5f16df02de425f479c3c8980196c1a8b4.png)  
Here my code. but sendFileMessages , doesn’t return a callback, but still get images when reload app.  
2) Why sendFileMessages =\>but don’t return fileImage array instead of file ?

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 15, 2021, 7:43am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/15 "2021-05-15T07:43:47Z")

</div>

> [@walter.rodriguez](#):
>
> ```auto
> const arrayParams = [];
> // Check all the selected files
> for (let file of files) {
> const params = new sb.FileMessageParams();
> params.file = file;
> params.fileName = file.name;
> params.fileSize = file.size;
> params.mimeType = file.type;
> // Add to the array
> arrayParams.push(params);
> } 
> 
> ```

 ![Screen Shot 2021-05-15 at 14.43.36](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/f/fc0d6b7ebfdc41018e4c09933a743c529c452607.png)

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 15, 2021, 7:44am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/16 "2021-05-15T07:44:11Z")

</div>

the params.file = source. that is correct or incorrect ? thank you

---

<div class="post-metadata">

**Author:** ![walter.rodriguez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/walter.rodriguez/32/546_2.png) [@walter.rodriguez](https://community.sendbird.com/u/walter.rodriguez)\
**Post date:** [May 15, 2021, 8:31am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/17 "2021-05-15T08:31:33Z")

</div>

If “source” is the type File, then yes, it’s correct.

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 15, 2021, 8:33am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/18 "2021-05-15T08:33:40Z")

</div>

I just make let source = {  
uri: image.path,  
name: `multipleFile + ${currentdate.getMilliseconds()}`,  
type: “image/jpg”,  
}  
then params.file = source;

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 15, 2021, 8:44am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/19 "2021-05-15T08:44:06Z")

</div>

Hi rodirguez pls help me to respond soon :((

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 15, 2021, 9:16am UTC](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172/20 "2021-05-15T09:16:23Z")

</div>

I check, the response and see that “sendingStatus”: “pending”, “silent”: false,

[Next page](https://community.sendbird.com/t/how-would-i-go-about-sending-a-file-message-with-multiple-images/1172.md?page=2)
