Skip to content

Instantly share code, notes, and snippets.

@tonis2
Created July 4, 2018 12:00
Show Gist options
  • Save tonis2/9f87420a12e409009761a45b5787e156 to your computer and use it in GitHub Desktop.
Save tonis2/9f87420a12e409009761a45b5787e156 to your computer and use it in GitHub Desktop.
UPLOAD to FIREBASE storage with REST API
### Add security rule for public access
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
POST to this url https://firebasestorage.googleapis.com/v0/b/[APP_ID]/o/[FOLDER_NAME]%[FOLDER_NAME]%2F[FILENAME]?alt=media
##POST HEADER
{
headers: { "Content-Type":"text/html" },
mode: "cors",
cache: "default"
};
@dahu33
Copy link

dahu33 commented Nov 25, 2021

I wish Google was documenting this... thanks for sharing!

@PCWilson3
Copy link

This was a huge lifesaver for me. Thanks for providing this!

@ClemCa
Copy link

ClemCa commented Mar 3, 2025

I spent so long looking for this I can't believe it.
I actually did find this an hour ago and didn't see that I was using storage instead of firebasestorage in my url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment