ckobasti
ckobasti•15mo ago

Storing image on Convex

Any tips how to store images in convex?
21 Replies
jamwt
jamwt•15mo ago
Hi! yeah, you should use https://uploadstuff.dev/
jamwt
jamwt•15mo ago
you can read more in our docs here if uploadstuff doesn't work for you: https://docs.convex.dev/file-storage/upload-files , but uploadstuff is the easiest way to solve this quickly
Uploading and Storing Files | Convex Developer Hub
Files can be uploaded by your users and stored in Convex.
ckobasti
ckobastiOP•15mo ago
Danggg thats dope Full-stack dream is happening with lot of easiness Thank you
jamwt
jamwt•15mo ago
that's the hope! no problem, good luck. let us know if we can help any more
ckobasti
ckobastiOP•15mo ago
Of course started developing edit user profile right now 🙂
ckobasti
ckobastiOP•15mo ago
No description
ckobasti
ckobastiOP•15mo ago
Error says that i shouldnt pass props to 'generateUploadUrl' even tho this is my function
ckobasti
ckobastiOP•15mo ago
No description
ckobasti
ckobastiOP•15mo ago
Even tho, again
ckobasti
ckobastiOP•15mo ago
No description
ckobasti
ckobastiOP•15mo ago
This is Uploadstuff doc
jamwt
jamwt•15mo ago
@Michal Srb might be able to weigh in.
ckobasti
ckobastiOP•15mo ago
Srb as me Got the id in the DB somehow.. It was the Uploadstuff docs issue. Looked up at node modules and found it.... Instead onCliendUploadComplete, its onUploadComplete
jamwt
jamwt•15mo ago
ahah! yeah, we might need a docs update here. thanks for the note @ckobasti !
ckobasti
ckobastiOP•15mo ago
You're welcome! Btw how to get the picture now in the frontend? i got the ID in db While you here haha
jamwt
jamwt•15mo ago
Serving Files | Convex Developer Hub
Files stored in Convex can be served to your users by generating a URL pointing
Michal Srb
Michal Srb•15mo ago
@ckobasti the first issue I assume was solved by making the argument into a function, like this:
uploadUrl={() => generateUploadUrl({id: convexUserId})}
uploadUrl={() => generateUploadUrl({id: convexUserId})}
? Thanks for reporting the other issue with onUploadComplete, will fix!
ckobasti
ckobastiOP•15mo ago
This works! thank you! still cannot get the image from db.. Is the ID in my db even the ID for image or for storage? how it works Trying to get things in my head with convex docs but its not the same as in my project
Michal Srb
Michal Srb•15mo ago
You want to pass the storage ID (type Id<"_storage">) to getUrl, like this: await ctx.storage.getUrl(storageId) You can do this in a query/mutation or action. It will give you a URL you can pass to an img tag.
ckobasti
ckobastiOP•15mo ago
Done. Thank you very much !!!!! Btw are you from Serbia? Nevermind.. My next question is, how to modify dropzone? I'm sorry for too many questions, but i wanna learn and use it for the rest of my life 🙂 I want my UI on it And modifying it in node modules doesnt work somehow
Michal Srb
Michal Srb•15mo ago
I am Czech 🙂 The dropzone question was answered in another thread.

Did you find this page helpful?