# How to determine if the FileMessage is an Image or a file?

**URL:** <https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326>\
**Category:** Flutter\
**Tags:** chatsdk\
**Created:** [August 16, 2022, 3:43am UTC](https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326 "2022-08-16T03:43:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arone\_Jerome](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Arone\_Jerome](https://community.sendbird.com/u/Arone_Jerome)\
**Post date:** [August 16, 2022, 3:43am UTC](https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326/1 "2022-08-16T03:43:34Z")

</div>

I’m using sendbird flutter package ([sendbird\_sdk | Flutter Package](https://pub.dev/packages/sendbird_sdk)) and It’s giving me a hard time to determine if Im going to display an image or a file from FileMessage. any suggestions or logic for this one? Thank you 😃

---

<div class="post-metadata">

**Author:** ![Akhil\_Gupta](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/akhil_gupta/32/1825_2.png) [@Akhil\_Gupta](https://community.sendbird.com/u/Akhil_Gupta)\
**Post date:** [August 17, 2022, 12:00pm UTC](https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326/2 "2022-08-17T12:00:49Z")

</div>

![Screenshot 2022-08-17 at 5.21.42 PM](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/f/f7fbc91d526b892c3b0df7d825960c0b9fd3e644.png)  
@Arone_Jerome Try using the ‘type’ key which is coming in BaseMessage object to check the extension of file. May be it will help in solving your issue.

@Arone_Jerome Have you tried sending pdf or doc file using flutter chat sdk? I am able to send the images but not able to send pdf or doc files. If you have worked on this kindly help me out.

---

<div class="post-metadata">

**Author:** ![Arone\_Jerome](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Arone\_Jerome](https://community.sendbird.com/u/Arone_Jerome)\
**Post date:** [August 18, 2022, 3:25am UTC](https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326/3 "2022-08-18T03:25:26Z")

</div>

Yeah, I did use already the type parameter. and validating if its an image or not. It’s working But suddenly I did also try to send file with .json extension. but the type paremeter is empty.

---

<div class="post-metadata">

**Author:** ![Akhil\_Gupta](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/akhil_gupta/32/1825_2.png) [@Akhil\_Gupta](https://community.sendbird.com/u/Akhil_Gupta)\
**Post date:** [August 18, 2022, 7:05am UTC](https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326/4 "2022-08-18T07:05:50Z")

</div>

@Arone_Jerome Can you confirm are you able to send pdf , doc or xls file from flutter chat sdk as I am getting issue in sending these type of files

---

<div class="post-metadata">

**Author:** ![Arone\_Jerome](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Arone\_Jerome](https://community.sendbird.com/u/Arone_Jerome)\
**Post date:** [August 22, 2022, 2:24am UTC](https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326/5 "2022-08-22T02:24:24Z")

</div>

Hello @Akhil_Gupta . yes, I’m able to send pdf, doc or xls without any problems. I did use [file\_picker | Flutter Package](https://pub.dev/packages/file_picker) package for selecting a file. Check my sample code on the image I provided.  
 ![Screen Shot 2022-08-22 at 10.21.21 AM](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/7/7a825c12f9abe17d1ce81aca630daaeb923f2cd5.png)

---

<div class="post-metadata">

**Author:** ![Arone\_Jerome](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Arone\_Jerome](https://community.sendbird.com/u/Arone_Jerome)\
**Post date:** [August 31, 2022, 4:49am UTC](https://community.sendbird.com/t/how-to-determine-if-the-filemessage-is-an-image-or-a-file/5326/6 "2022-08-31T04:49:55Z")

</div>

You can add customType on messages to detemine if the FileMessage is a file or not.
