Back

[SOLVED] Cannot access generated download link

  • 0
  • Users
  • Flutter
  • Storage
Olivier Pavie
9 Mar, 2023, 10:28

Hi, After uploading a file using the storage api, I generate a download link locally. When i try to preview the image using that link i get an error ( in the screenshot in red) But i am logged in on my application.

I am trying to access the image using Image.network({link}) from the application I can successfully load the image if i use the SDK method but that wont be convenient because i store the links as an array of string in the database

I know that it is possible to add headers inside Image.network() but which headers to add ?

TL;DR
The user was having trouble accessing a generated download link. The issue was solved by using the URL provided in the Appwrite Console and including the project ID in the URL for security purposes. The user also mentioned that they had tried adding read permission for guests, but still encountered the same error. They were trying to access the image using Image.network({link}) from their application and wanted to know which headers to add for convenience. No solution for adding headers was provided in the thread.
Olivier Pavie
9 Mar, 2023, 10:55

Update: I tried adding read permission to guest.... i still get the same error

Olivier Pavie
9 Mar, 2023, 11:10

Update2: I saw that you can get the link to the file from the console: after making some change i came up with

https://8080-appwrite-integrationfor-mn3gcq2j4mi.ws-us89b.gitpod.io/v1/storage/buckets/6409a2f7d1ef60253b32/files/6409afb74ac9b7320366/view?project=639d557f4ee80d9575fd Which work when guests have permission.... however do we really need to add the project ID inside the url?? What would be the best way to generate urls please?

Ps: The server is on Gitpod so the link might not work all the time

joeyouss
9 Mar, 2023, 11:51

Hi, thank you for your question, allow me to look into the best ways and get back to you

PS - Luffy's picture looks great haha

Olivier Pavie
9 Mar, 2023, 11:51

ok ok

Olivier Pavie
9 Mar, 2023, 11:53

ok ok no issue πŸ™‚ I will wait

joeyouss
9 Mar, 2023, 13:12

What you did is actually the correct way - using URL that you see in Appwrite Console. Talking about "do we really need to add the project ID inside the url?" - yes You can do custom ID for file ID. 2 projects can set same custom ID.. So without project ID, it would be impossible to know which project it belongs to. It's for security

Olivier Pavie
9 Mar, 2023, 15:37

ok ok i see, thanks πŸ™‚

Olivier Pavie
9 Mar, 2023, 16:35

[Solved]Cannot access generated download link

Olivier Pavie
9 Mar, 2023, 16:35

[SOLVED]Cannot access generated download link

Drake
9 Mar, 2023, 18:40

[SOLVED] Cannot access generated download link

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