Add public download url of the asset in StorageResponse #25
Comments
Thanks @paurakhsharma for opening an issue! Method to get public URL landed on supabase-js recently. I can try to get this implemented this weekend! |
@dshukertjr That sounds awesome. Looking forward to it 😍 |
@paurakhsharma, you can find the new public url feature on the latest version https://pub.dev/packages/supabase |
@dshukertjr @phamhieu Here is my code to get the Future<String?> uploadImage(PlatformFile file) async {
final fileName = '${DateTime.now().toString()}_${file.name}';
final response = await _client.storage.from('journalImages').upload(
fileName,
File(file.path!),
);
if (response.data == null) return null;
final downloadUrl =
_client.storage.from('journalImages').getPublicUrl(fileName).data;
print(downloadUrl);
return downloadUrl; This the the URL that gets printed out: https://dlrvdojpksbdmvnygpeb.supabase.co/storage/v1/object/public/journalImages/2021-06-22%2007:58:17.902992_IMG_0005.jpeg But it returns 404. Anything I am missing? |
@paurakhsharma can you check on your supabase project dashboard if maybe you can try to rename your folder to use |
Hey @paurakhsharma ! By default all buckets created in Supabase are private. You can go into your Supabase console's storage setting and make buckets public! |
Thanks, @dshukertjr, and @phamhieu for the quick response. Many thanks. |
First of all, Thank you for this amazing project.
Feature request
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Currently, I use a future builder to download the image and show it to the user.
Additional context
The text was updated successfully, but these errors were encountered: