Back

[SOLVED] Need help with adding files to my chat app

  • 0
  • Web
  • Storage
SreeSen
5 Nov, 2023, 07:20

I have a chat app which uses the Realtime API for the chats, I am trying to create a file sharing feature for the app using storage. But my question is how to show the photos(let's say) in the app. Like the photo should remain at the same position where it was sent. How do I achieve this?

TL;DR
User is asking for help with adding files to their chat app and displaying photos in the chat. They want the photos to persist even after the user refreshes the page. They are wondering how to show the photos in the app and have them remain at the same position where they were sent. They mention creating a new attribute in the message collection to store the image URL and using the previewImage endpoint. Another user suggests checking the documentation for storage and provides a link. The original user confirms they have read the documentation and thanks someone named Steven. The thread ends with someone saying the issue is solved. Solution: Create a new attribute in the message
Drake
5 Nov, 2023, 21:52

Remain at the same position? What do you mean?

SreeSen
6 Nov, 2023, 02:59

I think I overexplained my problem, sorry for that. I just want to send photos to my chat.

Drake
6 Nov, 2023, 03:00

Have you looked at this? https://appwrite.io/docs/products/storage

What exactly are you having problems with?

SreeSen
6 Nov, 2023, 03:03

How can I show the photos added to the storage in my chat?

SreeSen
6 Nov, 2023, 03:26

Yes I have read the docs, I want the photos to persist in the chat even after the user refreshes the page. One way I can think of is to create a new attribute in the message collection and add the image url to it and then display it in the chat.

Drake
6 Nov, 2023, 03:28

Yes

SreeSen
6 Nov, 2023, 03:37

Thankyou Steven!

SreeSen
6 Nov, 2023, 14:24

Implemented! Used this approach created an attribute in the messages collections named file_id and the used the previewImage endpoint to show it in the chat if the file_id is not null

D5
7 Nov, 2023, 20:22

Great!

D5
7 Nov, 2023, 20:22

Does that solves the issue?

SreeSen
10 Nov, 2023, 05:47

Ah! Yes it did. Closing this post.

Drake
10 Nov, 2023, 17:52

[SOLVED] Need help with adding files to my chat app

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more