react-component / react-component/upload
How to upload image to firebase
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 323
- Avg merge
- 12m
- Merged PRs (30d)
- 1
Description
Hello everyone!
I've been trying to implement firebase image upload using this library from antd.
Below is a function file which goes into the action prop in <Upload /> component.
export async function uploadImage(file) {
const storage = firebase.storage()
const metadata = {
contentType: 'image/jpeg'
}
const storageRef = await storage.ref()
const imageName = generateHashName()
const imgFile = storageRef.child(`Vince Wear/${imageName}.png`)
const uploadTask = await imgFile.put(file, metadata)
return new Promise((resolve, reject) => {
return resolve(uploadTask)
})
}
I can find the uploaded images from firebase but it always returns an error and looks like firebase is returning status of 501, Odd.
And this to the console
XML Parsing Error: syntax error
Location: http://localhost:3000/upload.do
Line Number 1, Column 1:
Is this a common issue? Any way to avoid it?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Upload component's action prop and the uploadImage function shown in the issue, then reproduce the Firebase Storage request and inspect the 501 response and localhost:3000/upload.do XML error. Done means identifying whether the failure is in this library's upload handling and documenting a confirmed resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100