Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungLandlock LSM: Sandbox-Linux ohne Root-Rechte sichern(22.09.2026 um 02:00 Uhr)
Sichere ProgrammierungQuarkus + GraalVM Advanced Obfuscation(22.09.2026 um 02:00 Uhr)
Sichere Programmierung06 — Chat Works. Does the Agent Actually Retrieve Memory?(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungMCP Debate: Token Tax, Context Bloat, and What Devs Can Do(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungI gave my AI agent a kill switch tied to its own bank balance(22.09.2026 um 02:08 Uhr)
Sichere ProgrammierungLandlock LSM: Sandbox-Linux ohne Root-Rechte sichern(22.09.2026 um 02:00 Uhr)
Sichere ProgrammierungQuarkus + GraalVM Advanced Obfuscation(22.09.2026 um 02:00 Uhr)
Sichere Programmierung06 — Chat Works. Does the Agent Actually Retrieve Memory?(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungMCP Debate: Token Tax, Context Bloat, and What Devs Can Do(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungI gave my AI agent a kill switch tied to its own bank balance(22.09.2026 um 02:08 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

How to upload an image into firebase storage

We will learn how to upload an image file into firebase using firebase storage like imageBB or postimages. We are gonna use firebase web sdk in our react-js project. Steps: Create a new firebase project. setup firebase storage. Choose…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

We will learn how to upload an image file into firebase using firebase storage like imageBB or postimages. We are gonna use firebase web sdk in our react-js project.



Steps:




  • Create a new firebase project.

  • setup firebase storage. Choose test mode option to get started. In notes section, I have shown how to use it longer.

  • Setup your local project folder in your computer. Setup firebase config file to link up with your firebase-project.

  • Initialize firebase-storage service:




    // >> inside firebase config file
import { getStorage } from 'firebase/storage';

// init storage service
const fbStorage = getStorage(app)
export {fbStorage}







  • Now we can create a form with an input (type- file) element and a submit button so that we can upload image from our computer. Add submit event handler to the form (handleUploadImage).




    <!-- upload form -->
<form onSubmit={handleUploadImage}>
<input type="file" name="imageInput" />
<button>Upload</button>
</form>






The form looks like this (apply your own styles):



upload form




  • We can choose an image from our computer by clicking "choose file" btn; after choosing image, we should click "upload" button. Then the form fires "onSubmit" event and invoke "handleUploadImage" function. Define "handleUploadImage" function:




    import { getDownloadURL, ref, uploadBytes } from "firebase/storage";
import { fbStorage } from "../../firebase.config"; // NB: define your own path

const handleUploadImage = async e => {
// prevent deafult form submit
e.preventDefault()

// get imageInput element inside form
const imageInput = e.target.imageInput
// imageInput is an array of files. we choose the fist file (which is image file)
const imageFile = imageInput.files[0]

// validate: show alert if no image is selected
if (!imageFile) {
alert('please, select a image!')
return
}

// create file path ref for firebase storage.
// if image filename is "eagle.jpg"; then the path would be "images/eagle.jpg"
const filePathRef = ref(fbStorage, `images/${imageFile.name}`)

// upload the image file into firebse storage
const uploadResult = await uploadBytes(filePathRef, imageFile)

// finally get image url which can be used to access image from your website
const imageUrl = await getDownloadURL(filePathRef)

// [ TODO: put your code here whatever you want to do with the "imageUrl" ]

// reset form (optional)
e.target.reset()
}






Now, you have successfully uploaded the image into firebase storage.



If you want to find the image in firebase website: open your firebase project (from firebase website) > firebase storage > Files (tab) > images > your images lives here. From here you can manage (delete, upload) your images manually.



image location of firebase storage






Notes:






Use storage for longer period:



test mode only keeps your storage active for 1 month. You must setup storage rules to use longer period. The easiest way is: go to firebase storage > select "Rules" tab > reset your date as new future date to use it longer. You have to learn security rules to use it more effectively. If you don't update security rules, anyone who has your firebase credentials can modify your data!



storage rules tab



storage rules date






Follow me (Rahat Faruk) to learn more about webdev content. If you want to learn new content, comment here. Thank you.



Connect with me: in/rahatfaruk

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to upload an image into firebase storage

Thematisch verwandte Begriffe: upload, image, into, firebase · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-49449 | Joplin is an open source note-taking and to-do application that organise…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick