Comments (4)
thank you so much....u save my life....
from quickstart-js.
I am also stuck with this issue, images overwrite themselves with the same name,
I found it very useful. Although one improvement i used Date.now() + file.name
instead. :)
from quickstart-js.
Here is now the full code in the end
const handleFileUpload = (file) => {
const storageRef = storage.ref();
const metadata = {
customMetadata: {
size: `${file.size}`,
title: `${file.name}`
},
};
const uploadTask = storageRef
.child("images/" + Date.now() + file.name)
.put(file, metadata);
uploadTask.on(
'state_changed',
(snapshot) => {
let progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log("Upload is " + progress + "% done");
setUpload(progress);
},
(error) => {
},
() => {
// Upload completed successfully, now we can get the download URL
uploadTask.snapshot.ref.getDownloadURL().then((downloadURL) => {
handleSetImageOnDocument(downloadURL, metadata.customMetadata);
});
}
);
}
from quickstart-js.
thank you so so much~~very appreciate it
from quickstart-js.
Related Issues (20)
- i dont want to show message onbackground because crashing with hundreds notification.
- before online after offline to much notification, there is any to check its last notification ? to prevent some trigger.
- Enter Custom Auth Code
- wrong README.md
- Problems integrating Firebase service woker with existing service-worker of react PWA HOT 1
- [Firebase Cloud Messaging Quickstart] Should be updated to use Firebase Cloud Messaging API (V1)
- Messaging: We are unable to register the default service worker. HOT 2
- Show two messages HOT 1
- Auth in chrome extension is not working
- The "Send Code" button for MFA is never enabled even after entering valid phone number and successful recaptcha HOT 1
- FCM HTTP V1 API
- Cors policy no longer allows calling cloud functions from browser. HOT 6
- Unable to start firebase project for existing instruction
- The GitHub authentication component is used on the Google Authentication page
- Server Key
- messaging quickstart does not work HOT 3
- not working the firebase config HOT 1
- Incorrect script in firestore quickstart readme
- Why canβt I get currentUser on my iPhone? HOT 1
- Fetch data from mobile is 35 times slower than on PC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quickstart-js.