React
[React] firebase storage 파일 업로드
dev22
2023. 2. 3. 17:03
728x90
https://developer-talk.tistory.com/567
[React]파일 업로드 구현
파일 업로드 구현 파일 업로드 버튼을 외부 라이브러리에서 제공하는 버튼 컴포넌트를 사용하고 싶은데 해당 라이브러리에서 파일 업로드 기능을 지원하지 않을 수 있습니다. 외부 라이브러리
developer-talk.tistory.com
https://forum.ionicframework.com/t/firebase-storage-unauthorized-due-to-storage-rule/191471
Firebase storage/unauthorized due to Storage Rule
Hello Group, My dev has run into Firebase Phone Auth error: I use this plugin to Phone auth https://ionicframework.com/docs/native/firebase-authentication. So how can I transfer that Auth details to the AngulraFireAuth? Original I have a Firebase Storage b
forum.ionicframework.com
/**
* 파일 업로드
*/
const handleChange = (event) => {
setFile(event.target.files[0]);
}
const handleUpload = () => {
if (!file) {
alert("Please upload an image first!");
}
const storageRef = ref(storage, `/manmul/${file.name}`);
// progress can be paused and resumed. It also exposes progress updates.
// Receives the storage reference and the file to upload.
const uploadTask = uploadBytesResumable(storageRef, file);
uploadTask.on(
"state_changed",
(snapshot) => {
const percent = Math.round(
(snapshot.bytesTransferred / snapshot.totalBytes) * 100
);
// update progress
setPercent(percent);
},
(err) => console.log(err),
() => {
// download url
getDownloadURL(uploadTask.snapshot.ref).then((url) => {
console.log(url);
});
}
);
};
<input type="file" onChange={handleChange} accept="/image/*" />
<button onClick={handleUpload}>Upload to Firebase</button><br/>


