Can I overwrite content on the file
Can I overwrite content on the file server or must I delete the existing file and create a new upload URL with the new file? I would like to overwrite PDFs that have been fetched and updated by the client if possible.
2 Replies
Delete + Upload a new file.
https://docs.convex.dev/file-storage/upload-files
Typically, you are saving the storage ID of the file in your database somewhere (eg
await db.insert("pdfs", {pdf: storage_id})
). You can overwrite that row of the table with a new storage ID with db.patch
or db.replace
. https://docs.convex.dev/database/writing-data#updating-existing-documents
But to your question - you cannot change the target that a given storage ID points to.Uploading and Storing Files | Convex Developer Hub
Files can be uploaded by your users and stored in Convex.
Writing Data | Convex Developer Hub
Mutations can insert, update, and
Thanks for the quick response @nipunn . I'll implement my update functions like how you suggested.