How to get image url after uploaded image ?
I wanna get image url with stroage id after I uploaded image
7 Replies
I tried but it's not working with 404 issue
https://precious-yak-175.convex.cloud
this is my development convex url
Thanks for the details. Where did you get the idea that https://happy-animal-123.convex.site/getImage?storageId=456 should work?
Ah, from the bottom of the docs. For that to work you need to set up the HTTP action.
Alternatively you can use a query:
https://docs.convex.dev/file-storage/serve-files#generating-file-urls-in-queries
Serving Files | Convex Developer Hub
Files stored in Convex can be served to your users by generating a URL pointing
From your first snippet, it also looks like you're not storing the Storage ID in the database. You might want to do that:
@Michal Srb yeah
I tried with useQuery
but here is issue
since useQuery is hook I can only call in the component not function
so I made query and it's getting storageId as a argument
so calling query like it but as you can see storageId is empty string at first
so it's getting issue
so setting storage id on here
how can I define state value as a Storage Id ?
If you don't want to store the storage ID and you just want the URL, you can either use a mutation or:
See https://docs.convex.dev/client/react#one-off-queries
Convex React | Convex Developer Hub
Convex React is the client library enabling your React application to interact
yeah it's working thank you