vikramsamakOriginal post
Web Developer
I want to get url of stored file and use it in document while storing it in database ...
Plain text
const storedPhotoDetails = await storage.createFile( 'bucket-id', uuidv4(), InputFile.fromBuffer(photobuffer, photo.name)) // Get URL of stored file try { const storage_url = await storage.getFile( 'bucket-id', storedPhotoDetails.$id) console.log(storage_url) } catch (error) { console.log(error) }```jsSummary
To get the URL of a stored file in Appwrite storage, you will need to build the URL manually. You can refer to the web SDK documentation for guidance on how to do this. Currently, there is no method provided by Appwrite SDKs to directly generate the URL. However, there is a feature request for this functionality on GitHub that you can support if you're interested. In the meantime, you can use the `createFile` method to store the file in a bucket and then use the `getFile` method to retrieve the URL of the stored file.