firebase-storage

how to list every element of storage files in firebase

旧巷老猫 提交于 2020-05-31 04:20:46
问题 How to list every element of storage files in firebase. In the official documentation there is no any word, about this. https://github.com/thisbejim/Pyrebase I want to iterate storage files: I use pyrebase, my code: firebase = pyrebase.initialize_app(config) db = firebase.database() storage = firebase.storage() 回答1: I know it's an old question but I thought I'd answer as I was looking for an answer to this same question storage = firebase.storage() files = storage.list_files() for file in

how to list every element of storage files in firebase

此生再无相见时 提交于 2020-05-31 04:20:10
问题 How to list every element of storage files in firebase. In the official documentation there is no any word, about this. https://github.com/thisbejim/Pyrebase I want to iterate storage files: I use pyrebase, my code: firebase = pyrebase.initialize_app(config) db = firebase.database() storage = firebase.storage() 回答1: I know it's an old question but I thought I'd answer as I was looking for an answer to this same question storage = firebase.storage() files = storage.list_files() for file in

Firebase image upload in async await manner

孤街浪徒 提交于 2020-05-28 05:26:26
问题 async UPLOAD_IMAGES() { try { let self = this; var storageRef = firebase.storage().ref(); var files = document.getElementById("photoupload").files; var file = files[0]; // Create the file metadata var metadata = { contentType: "image/jpeg" }; // Upload file and metadata to the object 'images/mountains.jpg' var uploadTask = storageRef .child(`${this.name}/` + file.name) .put(file, metadata); // Listen for state changes, errors, and completion of the upload. uploadTask.on( firebase.storage

how do I check the file size of a video in flutter before uploading

谁说胖子不能爱 提交于 2020-05-25 06:48:27
问题 I want to upload a video file to my cloud storage but I want to check the size of the video file before I upload. how to achieve this 回答1: If you have the path of the file, you can use dart:io var file = File('the_path_to_the_video.mp4'); You an either use: print(file.lengthSync()); or print (await file.length()); Note: The size returned is in bytes . 回答2: If you have file object then you can call length() on the file object. int fileLength = await file.length(); length() returns a Future<int

using the image assigned to userprofile in firebase and attachine it to profile page

自作多情 提交于 2020-05-24 05:48:11
问题 I have been looking online everywhere to help me out here but I cannot figure this out. The code below says that allows for the image to get stored in the firebase database when the user registers: func uploadProfileImage(_ image: UIImage, completion: @escaping ((_ url: URL?)->())){ guard let uid = Auth.auth().currentUser?.uid else {return} let storageRef = Storage.storage().reference().child("user/\(uid)") guard let imageData = image.jpegData(compressionQuality: 0.75 ) else {return} let

Firebase function (written in NodeJS) to delete file from Cloud Storage when an object is removed from Realtime Database

℡╲_俬逩灬. 提交于 2020-05-23 04:34:04
问题 I am new to NodeJS and I am trying to write the next method for Cloud Functions for Firebase. What I am trying to achieve: The function should be triggered when the user removes a Photo object from Firebase DB; The code should remove the file object from Storage corresponding to the Photo obj. These is my Firebase DB structure: photos/{userUID}/{photoUID} { "dateCreated": "2017-07-27T16:40:31.000000Z", "isProfilePhoto": true, "isSafe": true, "uid": "{photoUID}", "userUID": "{userUID}" } And

download url is getting as com.google.android.gms.tasks.zzu@441942b : Firebase Storage [Kotlin] [Solved]

我与影子孤独终老i 提交于 2020-05-21 02:00:47
问题 i have checked available resources and yet either i get error or at best i get com.google.android.gms.tasks.zzu@5f9a842 as the uri Following this latest google doc here, i still got the com.gms as url here is my code val fileRef = storageProfilePicRef!!.child(firebaseUser.uid + "jpg") val uploadTask = fileRef.putFile(imageUri!!) uploadTask.continueWith { if (!it.isSuccessful) { pd.dismiss() it.exception?.let { t -> throw t } } fileRef.downloadUrl }.addOnCompleteListener { if (it.isSuccessful)

download url is getting as com.google.android.gms.tasks.zzu@441942b : Firebase Storage [Kotlin] [Solved]

淺唱寂寞╮ 提交于 2020-05-21 02:00:33
问题 i have checked available resources and yet either i get error or at best i get com.google.android.gms.tasks.zzu@5f9a842 as the uri Following this latest google doc here, i still got the com.gms as url here is my code val fileRef = storageProfilePicRef!!.child(firebaseUser.uid + "jpg") val uploadTask = fileRef.putFile(imageUri!!) uploadTask.continueWith { if (!it.isSuccessful) { pd.dismiss() it.exception?.let { t -> throw t } } fileRef.downloadUrl }.addOnCompleteListener { if (it.isSuccessful)

app crashes while retrieve downloadURL.result

╄→尐↘猪︶ㄣ 提交于 2020-05-17 07:17:26
问题 As soon as I try to retrieve the downloadUrl of my upload (upload works fine) with downloadUrl.result the app crashes. The app does not crash when using downloadUrl.toString() instead but that does not give me the downloadUrl as a String. I have read through forums where people had similar problems but I could not resolve mine. Thank you in advance private fun uploadImageToFirebase(){ val profileImageRef = FirebaseStorage.getInstance().getReference("profilepics/" + System.currentTimeMillis()

Firebase Storage Rules - access granted doesn't match rules

烈酒焚心 提交于 2020-05-15 08:02:08
问题 Here is my rules : rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /{country}/{type}/{allPaths=**} { allow read, write; } } } For some reason I can write and read in this path : child(Test).child("Image.jpg") but it shouldn't be. I should only be able to write and read in this path child(Test).child(Test2).child("Image.jpg") Test and Test2 are both variables. Am I missing something? 回答1: It's working as I would expect. In security rules version 2, recursive