I was trying to decipher the documentation on this, anyone know how to get the file url? I am doing something like this and am getting the file.$id, but then when I try to get that json, it is empty. Do I need to create a new storage object or something?
// Upload the file to Appwrite Storage
const file = await storage.createFile(
config.appwriteFilesId, // Your Appwrite bucket ID
ID.unique(), // Use unique() for unique ID generation
inputFile // Upload the file buffer
);
console.log("File uploaded successfully. File ID:", file.$id);
// Get the URL of the uploaded file
const fileView = await storage.getFile(config.appwriteFilesId, file.$id);
think I figured this out: appwrite doesn't give you the full url, you have to construct it yourself from the metadata provided. You can do something like this:
const fileUrl =
${config.endpoint}/storage/buckets/${config.appwriteFilesId}/files/${file.$id}/view`;
Recommended threads
- Unhandled Runtime Error[ Server ] Error:...
Since yesterday, I am getting this error : Error: Invalid document structure: Missing required attribute "bucketField" in my project with appwrite as the backen...
- Admin Impersonating Clients?
I have a client that needs to use the admin User, to impersonate the Clients in order to debug better the App and the services that they are providing, could yo...
- record showing stuck unable to delete or...
Has anyone encounter this issue? or know of a way to get around it? deleting the record is not possible the record cant be found. Editing cant be done either