showing results for - "firebase upload file"
Devin
08 Mar 2017
1const [imagetoPost, setImagetoPost] = useState(null);
2
3const sendPost = (e) => {
4	e.preventDefault();
5	if (!post) return null;
6	db.collection('posts')
7		.add({
8			// whatever you want to add other than file
9		})
10		.then((doc) => {
11			if (imagetoPost) {
12				// upload stuff
13				const uploadTask = storage
14					.ref(`posts/${doc.id}`)
15					.putString(imagetoPost, 'data_url');
16
17					// OPTIONAL: here you can remove the file from state
18
19				uploadTask.on(
20					'state_change',
21					null,
22					(error) => console.error(error),
23					() => {
24						// when the upload completes
25						storage
26							.ref(`posts/${doc.id}`)
27							.getDownloadURL()
28							.then((url) => {
29								db.collection('posts').doc(doc.id).set(
30									{ postImage: url },
31									{ merge: true }
32								);
33							});
34					}
35				);
36			}
37		});
38};
39
40const addPostImage = (e) => {
41	const reader = new FileReader();
42	if (e.target.files[0]) {
43		reader.readAsDataURL(e.target.files[0]);
44	}
45
46	reader.onload = (readerEvent) => {
47		setImagetoPost(readerEvent.target.result);
48	};
49};
Maia
19 Jun 2020
1<!DOCTYPE html>
2<html>
3<head>
4	<title>Firebase Web Basics</title>
5
6	<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,700" rel="stylesheet">
7
8	<script src="https://use.fontawesome.com/939e9dd52c.js"></script>
9
10	<link rel="stylesheet" type="text/css" href="style.css">
11</head>
12<body>
13
14	<div class="mainDiv" align="right">
15		<h1 align="left">Firebase File Upload</h1>
16		<progress id="uploader" value="0" max="100">0%</progress>
17		<input type="file" id="fileButton" value="upload"/>
18	</div>
19
20
21
22<script src="https://www.gstatic.com/firebasejs/3.7.4/firebase.js"></script>
23<script>
24  // Initialize Firebase
25  var config = {
26    apiKey: "******************************",
27    authDomain: "******************************",
28    databaseURL: "******************************",
29    storageBucket: "******************************",
30    messagingSenderId: "******************************"
31  };
32  firebase.initializeApp(config);
33  //-------------------------------------
34  
35  var uploader = document.getElementById('uploader');
36  var fileButton =         document.getElementById('fileButton');
37  fileButton.addEventListener('change', function(e){
38  var file = e.target.files[0];
39  var storageRef = firebase.storage().ref('img/'+file.name);
40  var task = storageRef.put(file);
41  task.on('state_changed', function progress(snapshot) {
42    var percentage = (snapshot.bytesTransferred/snapshot.totalBytes)*100;
43    uploader.value = percentage;
44
45  }, function error(err) {
46
47
48  },function complete() {
49
50  });
51});  
52  
53  
54</script>
55
56<script src="fileup.js">
57</script>
58</body>
59</html>
queries leading to this page
how to upload images on firebasefirebase upload file in webupload file from url firebaseadd file to firebase storagefirebase upload remote file image types firbase acceptsandroid firebase file upload exampleupload image to firebase storage javascript apihow to upload image to firebase storage throgh web pagehow to upload file data in firebase realtime databasefirebase storage upload imagefirebase storage htmlfile api storage firebasefile upload to firebasefirestore upload property in documentfirebase file uploadfirestore upload file from urlupload an image in html to firebaseweb firebase storage 28 29firebase storage upload not saving filetypefirebase storage upload download examplecan we upload files to firebaseupload firebaseupload file to firebase storage in particular folerupload firestorage upload filelogin and upload image firebase javascripthow to upload images to firebase hostingfirebase storage upload from urlhtml upload file to firebaselocal file to firebase storage javascriptstorageref put in firebasehow to upload file to firestore and update urlfirebase upload image and get url classes firebaseupload file in firebaseupload photo from url string to firebase storage javascriptcan i upload zip files to firebase storageon file upload success to firestorageupload file on firebase storageupload files firebase storagefirebase upload file firebaseupload file to firebase storage javascriptfirebase python storage upload image and create access tokenfirebase web upload image display upload urlfile upload in firebase storagehow to save apicture to firebasehow to upload images to firebasefirebase upload remote url fileupload image and get url in firestorefirebase storge upload urlupload dsym to firebaseform image upload to firebaseupload image to firebaseuploaad iame in firebasejavascript firebase file uploadadd file to storage firebasehow to upload file to firebasefirebase update a filehow to upload images to firestoreupload image to firebase firestore javascriptfirebase file upload and get url javascriptfirebase file upload with button clickfirebase upload image and show upload urlhow to link file in firebase storage to firebase databasehow to upload file in firebase storagehow to upload image on firebase in webfirebase storage upload filefirebase storage web 5chow to upload videos to firebase javascriptfirebase store uploadfirebase storage uploaduplod all images to fire store upload file on firebasefirebase storage upload file to a folderfirebase storage file uploadupload image to firestorerequest files upload to firebaseupload a file in firebasefirebase storage upload input fileupload files on firebase storage with authenticationupload file firebase storagefirebase upload file jshow to upload to firebasefirebase storage upload from linkjs firebase upload filesstorage ref put firebasefirebase storage webupload image to firebase storage javascript 2020file upload in firebaseupload file from a string javascript firebasefirebase uploadupload file on firestoreupload into firebaseuploading image to a post firebaseupload files firebasehow to upload to firebase storagefirebase upload filesupload image file to firebaseupload html files to firebaseupload file using firebase storagesend a blob to firebasefirebase upload files from webhow to upload file firebase storagefile upload firebasehow to store images in firebase storage folderupload files through firebasehow do i upload files to firebase storage 3fupload image and get url firebaseupload files to firebasehow to get the url when is uploaded the file to firestore using javascript in webfirebase uploadfilehow to save image in firestoreto upload data to firebase storeupload on firebaseupload file with firebase storageusing firebase storage to upload filesfirebase image upload webupload a file to firestorefile upload in firestore firestore upload result file pathhow to upload image to firebase throgh web formupload pdf to firebase htmlinput file firebaseupload video to storage javascriptupload html file to firebasefirebase storage pageupload images in web storgaeupload a file to firebase storagefirebase upload dsymfirebase storage upload file blobupload image to firebase javascriptupload html files to google firebasefirrebase file uploadupload file with html and javascript to firebasefirebase file upload examplehow to save image in firebasenode js upload file to firebase storagesubmit image upload to firebase firesatorhow to upload a file in firebase storage from a urlfirebase form uploadhow to upload file to firebase stotage and add into firestoreupload firebase storagecan i upload files to firebasefirebase refrence uploaded filefirebase post file to storageupload files to firebase using jshow to get upload link in firestore add firebase in js upload dataupload firebase storagesubmit fies in firebaseupload file 3a 2f 2f 2f to firebase cloudfirestore in php upload filefirebase storage upload file webuploading files to firebasefile upload with firebasefirebase upload imagefirebase storage save file locallyprogess bar in firebase file storage in webupload to firestore webupload file in firebase storageupload file firebasefiles on firebasefirebase upload image and get urlput image in firebase through linkupload data to firebase databasefirestore upload filesfile upload cancel 28 29 resume 28 29 firebaseupload html file firebase storageuploading images to firebasefirebase uploading imagesupload file in storage and savev link in firestorehow to upload image to firestoreupload documents to firebasemanually create image metadata in firebase storageupload file from server to firebase storagefile upload form to firebasefirebase storage web display upoaded imagesfirebase function upload filefile upload with firebase storage tutorialfire base upload picturefirebase function file upload upload fireabse javascripthow to upload files on firebase storagehow to store file in firsebase storageupload and display image in firebase javascripthow to check the status of image upload to firebase javascriptuploaded file storage to imgfile upload html firebasemultiple photo upload firebasedsyms upload in firebasehow to upload site directly to firebasefirebase upload file from urlweb upload image file firebasehow to upload fileto firebase storagefirebase js upload fileupload file realtime database firebasefirebase file uploadsfirebase storage put function string url pictureupload files using firebase uploadfirebase file uploaderupload files on web firebase and display on pagehow to upload files to firebasefirebase storage upload filesfirebase upload fileupload image to firebase storage and get urlupload all images to firestorecancel uploading file in react firebaseupload image to firebasefile upload firbasefirebase upload file responsefirestore image uploadupload files directly to storage firebasefire base uploud imageupload documents firebasefirebase storage download fileupload file to firebase storage jashow to save image in firebase webadd image to firebasefirebase storageref putupload file to firebaseupload file in firestoreupload to firebaseupload fireabse succes javascripthow to save an image in firebase databasehow to upload the file to firestore using javascript in webfirebase upload file to storagefirebase storage save fileupload image to firebase storage javascripthow to upload pdf to firebaseupload file to firebase storage by urlhow to upload files in firebase webwhere to store uploaded images for website firebasefirebase storage upload over httpfirebase upload image display upload urlhow to upload a file in firebase storagewrite a firebase filehow to upload file from html to firebase and then get linkfirebase upload codehow to upload photos to firebaseimage upload firebaseupload code in firebasefirebase upload datafirebase upload files exemple codeupload files on firebasecan i upload files to firebase functionsupload file from input to firebasehow to upload files to firebase storagecan you upload files on firebasefirebase function upload file to storagefireuploader firestore javascriptupload files to firebase storage via web applicationuploasing file to firebase storagefirebase storage upload from streamupload files to firebase hostingupload videos to firebasefirebase web show uploaded images examplehow to put files to firebasefirebase upload file 7efrom urlupload a file in firebase using javascriptupload to storage firebasefirebase upload file fileref putloading javascript firebase uploadhow to upload file to firebase storagehow to upload a file to firebase through html form inputwhat kind of files can you upload to firebase storagehtml firebase uploaduploading a file on firebase storagefirebase javascript upload file from blobimginx firebase storage imageupload images to firebase jsfirebase upload file with javascriptupload firebase image javascriptupload files to firebase storagesave image to firebase storagehow to add pdf and photo on firebaseupload htmpl on firebasefirebase upload to firestorehow to upload files in firebasefirestore storage upload file from urlfirebase upload dsym fileadd firebase in js upload data stringfirebase image uploadupload image to firebase and get urlfirebase local host cancel up 3bload errorfirestore image typeupload file to firebase storagehow to upload file on firebase cloudfirebase file and image uploadfiresbase upload fileupload file to file storehow to upload file manually in firebasefile upload website fireupload files on web firebasesave file from form firebasefirebase cloud storage upload filefirebase storage upload exampleupload pdf to firebase storage nodejssave image in firebasehow to upload image to firebase from web form codefirebase upload var contenthow to add a file in firebase storageupload files to firebase dbfirebase file upload demohow to upload file data in firebase manually databasehow to upload a file to firebase storageupload data to firebaseeasy way to upload data to firebasegoogle firestore upload imagesfirebase storea uploadfirebase js file uploadfirebase upload file