Back

what facility of appwrite storage should I use depending on my use case?

  • 0
  • Web
Ayush
25 Jun, 2023, 19:21

I am building map based application when clicking on the map no image of that place is uploaded by default

User can upload images of the place he/she clicked on the map the the image user uploaded on the map gets uploaded via storage.createFile(bucketid,placeid,selectedImage)

so what i am doing currently to make this idea possible with the help of bucketid and **place(id) place is the fileid for appwrite ** going to that location using storage.getFilePreview(bucketid,placeid) and getting the image in response.href

but the response.href is a link for which image wasn't uploaded first

response.href works only after user uploads image of that place till then before the image has not got uploaded how do I check whether the image is uploaded or not to set the state of my variable in reactjs

TL;DR
Based on the support thread, the user is trying to determine which facility of Appwrite storage to use for their map-based application. They want to show a default image if the user has not uploaded an image for a specific place on the map. Currently, they are using `storage.getFilePreview(bucketid, placeid)` to retrieve the image for a specific place. However, this only works if the image has been uploaded. To set the state of their variable in ReactJS, they need to find a way to check if the image has been uploaded or not. One suggestion made in the thread is to call `storage.getFile(bucket
Ayush
25 Jun, 2023, 19:23

sorry if post sounds confusing but i need help what should i usestorage.FilePreview() is this correct ?

Drake
25 Jun, 2023, 23:58

That might throw an error if the file doesn't exist

Drake
25 Jun, 2023, 23:59

You might need to call get file to see if the file exists and then default to some placeholder if it doesn't

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