uploadTask.on(
"state_changed",
(snapshot) => {
const progress =
(snapshot.bytesTransferred / snapshot.totalBytes) * 100;
setProgress(progress);
switch (snapshot.state) {
case "paused":
console.log("Upload is paused");
break;
case "running":
console.log("Upload is running");
break;
default:
break;
}
},
(error) => {
console.log(error);
},
() => {
getDownloadURL(uploadTask.snapshot.ref).then((downloadURL) => {
setData((prev) => ({
...prev,
img: downloadURL,
}));
});
}
);

I believe this is because the download URL is a place to download the image, not a place that is hosting the image. You could try finding the image url instead of the download URL, or you could download the image and reference it from there (possibility delete it after?). For the former, reference the documentation of the library you are using. The latter would probably not be good for performance but it could be an easy way to get things done if you don't need performance.