# onSendFileMessage not working when type is set to "image"

**URL:** <https://community.sendbird.com/t/onsendfilemessage-not-working-when-type-is-set-to-image/5819>\
**Category:** React Native\
**Tags:** group-channel\
**Created:** [October 26, 2022, 1:23pm UTC](https://community.sendbird.com/t/onsendfilemessage-not-working-when-type-is-set-to-image/5819 "2022-10-26T13:23:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cory\_Cunningham](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/cory_cunningham/32/3017_2.png) [@Cory\_Cunningham](https://community.sendbird.com/u/Cory_Cunningham)\
**Post date:** [October 26, 2022, 1:23pm UTC](https://community.sendbird.com/t/onsendfilemessage-not-working-when-type-is-set-to-image/5819/1 "2022-10-26T13:23:00Z")

</div>

**[Problem]**  
I’m creating a custom `<Input />` for my group channels so I am able to automate tests easier around it. While doing so I noticed that sending this object

```json
{
      uri: photo.path,
      size: photo.size,
      name: photo.mime,
      type: "image",
}

```

that the resulting message type === `file` when rending in the list.

**Update**  
After doing some digging in the codebase it looks like  
[regex.ts#L56](https://github.com/sendbird/sendbird-uikit-react-native/blob/aed36a4404d0de71b6105c8266b320eb4fd2aa96/packages/uikit-utils/src/shared/regex.ts#L56) is the root issue. If I change the `type` above to `image/` or use the `photo.mime` prop it works. This could probably be solved with more type definitions or improved docs on how to handle this particular use case.

* * *

**[UIKit Version]**  
// What version of the SDK are you using? 2.0.0

**[Current impact]**  
Images are not showing in messages list and when a user taps on them they are taken to their web browser to view the 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:** [October 27, 2022, 5:39am UTC](https://community.sendbird.com/t/onsendfilemessage-not-working-when-type-is-set-to-image/5819/2 "2022-10-27T05:39:01Z")

</div>

Hi @Cory_Cunningham,

As you discovered, this is expecting a [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types), and thus purely passing `image` is not expected to work. I’ll talk with the team about trying to make that more explicitly clear.

---

<div class="post-metadata">

**Author:** ![Cory\_Cunningham](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/cory_cunningham/32/3017_2.png) [@Cory\_Cunningham](https://community.sendbird.com/u/Cory_Cunningham)\
**Post date:** [February 15, 2023, 2:32pm UTC](https://community.sendbird.com/t/onsendfilemessage-not-working-when-type-is-set-to-image/5819/3 "2023-02-15T14:32:18Z")

</div>

Thanks for the response!

I feel like a simple (outsider) solution would be to have a simple type attached to that function that tells us via intellisense (or digging in the code) what is expected.

I’m sure you’re thinking of better solutions though since it’s your code! 🙂
