Download URL not present in Firebase Console - firebase

There is no url present in the file location of firebase storage. Instead it gives a storage path. Please help.enter image description here

Just click the image and there is your URL:
To get the URL through Flutter, you can follow this answer:
https://stackoverflow.com/a/54086124/11231634

Download URLs are not/no longer automatically generated when you add a file to Cloud Storage through the Firebase SDK. Instead you will have to call getDownloadURL() to generate such a download URL. This URL will then also show up in the Firebase console.

Unfortunately, in my case, some files cannot be downloaded as Vitor suggests. I don't know why, but there's just a plain text instead of link.
Solution
Just download it via Cloud Storage at Google Console. This works every time.

Related

Can't access uploaded files through Firebase storage on web

I'm trying to access/download files that have been uploaded to Firebase storage but I can't figure out how to. Some of the files have a create new access token button under the storage location which gives me a link to the file on the web. Unfortunately, this is only a few files and seems to only be ones uploaded from localhost?
I can't find any reference to this on the documentation, this should be achievable through the Firebase dashboard?
I've tried setting the access rules to allow reads in all cases which hasn't helped.
Thanks
In general, you're supposed to use getDownloadURL(), as shown in the documentation, from within your web or mobile app to generate a download URL for use within your app. Typically, the console is only used to revoke the tokens that enable to download of each file through that URL.
If that's not specifically what you're trying to do, perhaps you want to read up on other was to make data public in Cloud Storage. The Firebase console is not really the best mechanism to manage downloadable content.

Manually uploading files to Firebase storage and adding it to Firestore

I have an app that all it does is to present PDF documents that is stored in Firebase.
I've created a collection in Firestore with all the relevant information for the documents (title, description etc.) and all is left to do is to provide a download URL to the PDF itself.
I've uploaded the PDF manually to Firebase Storage, but I couldn't find a way to manually copy the file URL in order to paste it in the Firestore.
How can I add the URL for the files Manually? (My client doesn't write code and he needs to update the files constantly).
Thank you!
Simply click the link shown in the picture below, then copy the URL it directs you to.

How To pull photo down and display it from firebase?

I am making a react native app with expo and firebase. I have uploaded photos to firebase successfully as a blob but want to be able to pull the photos down from firebase and display them to the user. I need to be able to display the user's profile photos whenever they log out or back into the app.
I am not finding any documentation in Expo/React Native/Firebase about downloading. I am only seeing docs on uploading and blobs.
Can anyone point me in the right direction? Is uploading the blob form of the photo and downloading it the correct way to save photos from a user's phone to the database?
These are the resources I have reviewed:
https://firebase.google.com/docs/storage/web/download-files
https://docs.expo.io/versions/latest/sdk/imagepicker/
https://github.com/expo/firebase-storage-upload-example/blob/master/App.js
https://forums.expo.io/t/uploading-images-without-react-native-fetch-blob/981/7
The Cloud Storage SDK from Firebase for JavaScript doesn't have any methods to directly download the bytes from a file.
The way to download the data is through the download URL. So you first get the download URL of the file you're interested in, and then download the data with for example an XMLHttpRequest (as shown in the example in the documentation), or with a similar method for your platform to download data from a URL. For expo the latter seems to be FileSystem.downloadAsync(...).

Firebase Cloud Storage download url vs path

I'm new to firebase storage and wants to know what is the best practice.
I want to upload image to firebase cloud storage and was returned a download url which I then stored to firestore. Is the download url permanent? Other users will read from the firestore to get the url to download the image.
But when I want to delete the image from CloudStorage, I only have the download url but not the file path. So do I delete it ?
If I store the file path instead, how to get the download url ?
Is the download url permanent?
The download URL will work until you revoke it.
I only have the download url but not the file path. So do I delete it?
You can get a StorageReference from a download URL by calling FirebaseStorage.getReferenceFromUrl() (or the equivalent for your platform).
If I store the file path instead, how to get the download url?
You can create a StorageReference for the path with FirebaseStorage.getReference(), and then call StorageReference.getDownloadUrl().
I know it's an old post but this is what I use in Flutter:
final Reference storageReferenceFromUrl = FirebaseStorage.instance.refFromURL(downloadPhotoPath!);
storageReferenceFromUrl.delete();
Hopefully, this helps.

Firebase Storage gs url to http

I downloaded a Unity project that use images stored in Firebase server using the following link:
https://zplayer360-86b30.firebaseapp.com
Now I want to reproduce this with my own file. I created a Firebase project using Firebase Console, uploaded manually the images, but now I click "copy folder url" button and it provide me only this link:
gs://insidehome-29c9e.appspot.com/
I need a free HTTP public link.
How can I obtain this?
When you upload a file to Firebase Storage, it automatically gets:
a Google Storage URL (starting with gs://), which you can use to access the file through the Firebase Storage SDK and the Google Storage API.
a download URL (starting with https://), which is a publicly-readable-but-non-guessable URL that you can use to download the URL with regular HTTP clients
What you're looking for is the second URL, which you can find in the Firebase Storage console when you select a file:
At the bottom right you can see the download URLs for the file. One of these is auto-created when you upload the file, but you can create more of them or revoke existing ones.
I am not entirely sure what you mean by "free" URL. The link is publicly readable, but downloads will count against your Firebase Storage download quota of course.
If there are no rules on Firebase storage. You are not protected.
Then it's publicly-readable-and-guessable, One can convert gs:// URL to https:// to download any file without Google SDK's.
https://firebasestorage.googleapis.com/v0/b/[projectID].appspot.com/o/[folderName]%2F[fileName]
Google Storage URL
gs://invitepeople-5d38c.appspot.com/profilePhotos/profile_1.jpg
Https downloadable URL
https://firebasestorage.googleapis.com/v0/b/invitepeople-5d38c.appspot.com/o/profilePhotos%2Fprofile_1.jpg?alt=media
Don't guess profile_2.jpg :)

Resources