Back

[SOLVED] Get Uploaded File URL

  • 0
  • Flutter
  • Storage
Khushal@2303
21 Jun, 2023, 13:02

I want to get upload file url, when file create successfully. How I can achieve that?

TL;DR
To get the URL of an uploaded file in Appwrite, you can use the following endpoint: https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] Replace [BUCKET_ID], [FILE_ID], [PROJECT_ID] with the appropriate values. If you're not using the cloud, replace "cloud.appwrite.io" with your own domain. You can also use the getFilePreview method in the Appwrite SDK to retrieve the file URL. Make sure to use the file ID obtained from the createFile method. Appwrite storage does not automatically create URLs for
Binyamin
21 Jun, 2023, 13:05
Binyamin
21 Jun, 2023, 13:06

When you use the createFile method you'll get back the file ID, use it in getFilePreview method.

Khushal@2303
21 Jun, 2023, 13:18

In the console when I go to file detail, I can see the FileUrl button, I'm surprise why I want to call another api getFilePreview.

Binyamin
21 Jun, 2023, 13:21

Click on the button You'll get the file preview URL. If you want to just have URL you can use this https://appwrite.io/docs/rest#no-headers

TypeScript
https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID]

Replace

  • [BUCKET_ID]
  • [FILE_ID]
  • [PROJECT_ID] And
  • cloud.appwrite.io if you're not using the cloud.
Khushal@2303
21 Jun, 2023, 13:25

Okay, got it your point.

Binyamin
21 Jun, 2023, 13:28

<:appwriteupvote:899677724615016528>

Susmita
21 Jun, 2023, 14:15

Hey, if this issue has been solved, kindly edit the post title as solved. Thank you

Khushal@2303
21 Jun, 2023, 14:28

[Solved]Get Uploaded File URL

Drake
21 Jun, 2023, 16:29

[SOLVED] Get Uploaded File URL

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more