
I want to get url of stored file and use it in document while storing it in database ...
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)
}```js

Is this with the web sdk? Or node?

No I m using server SDK (in Next js project)

Node

You would need to build the url manually. See the web sdk: https://github.com/appwrite/sdk-for-web/blob/ca4ef6dd0f8d7110db57f8b3b295ce62e629eec5/src/services/storage.ts#L314
We plan to introduce methods for building the url in all SDKs, but we haven't had time to focus on it. If you're interested in the feature, make sure to 👍 https://github.com/appwrite/sdk-generator/issues/557

Thanks @Steven
Recommended threads
- Unexpected File Persistence Across Appwr...
I'm encountering an issue where files created during an Appwrite Function execution persist across subsequent executions. Specifically, when a function writes a...
- Upload file
i got this error when try upload file (.Net). I use this line to check my buucket and its all right var buckets = await appWriterInit.Storage.List...
- Cannot connect to SMTP in AppWrite - set...
This used to work and then at some point it stopped. One thing that happened in that time was moving my application to Vercel. I have read on another thread t...
