You upload a file named image.png to Firebase Storage. Then you upload another file with the same name image.png to the same location. What is the result?
Think about how cloud storage usually handles files with the same path.
Firebase Storage treats files by their full path. Uploading a file with the same path overwrites the existing file silently.
Choose the Firebase Storage security rule snippet that restricts file uploads to authenticated users only.
rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow write: if <condition>; } } }
Authenticated users have a non-null request.auth object.
The condition request.auth != null ensures only signed-in users can write (upload) files.
After uploading a file to Firebase Storage, you want to get its public download URL. Which code snippet correctly does this?
import { getStorage, ref, uploadBytes, getDownloadURL } from 'firebase/storage'; const storage = getStorage(); const storageRef = ref(storage, 'files/myFile.txt'); // Assume file is a File object from input uploadBytes(storageRef, file).then((snapshot) => { // What goes here? });
Look at the Firebase Storage API for getting download URLs after upload.
The uploadBytes returns a snapshot with a ref property. Use getDownloadURL(snapshot.ref) to get the URL.
You want to allow users to upload large files that can resume if interrupted. Which Firebase Storage upload method supports this?
Firebase Storage has a built-in method for resumable uploads.
The uploadBytesResumable() method supports resumable uploads and progress monitoring natively.
You want to prevent users from overwriting files uploaded by others in Firebase Storage. Which security rule approach achieves this?
Think about how to prevent overwriting existing files by checking their existence.
Checking resource == null ensures files cannot be overwritten once uploaded, combined with authentication.