Last active
January 3, 2021 20:33
-
-
Save codeBelt/b922c894b18219b64bab0303ec35853e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const IndexPage = (props) => { | |
const onChange = async (formData) => { | |
const config = { | |
headers: { 'content-type': 'multipart/form-data' }, | |
onUploadProgress: (event) => { | |
console.log(`Current progress:`, Math.round((event.loaded * 100) / event.total)); | |
}, | |
}; | |
const response = await axios.post('/api/uploads', formData, config); | |
console.log('response', response.data); | |
}; | |
return ( | |
<UiFileInputButton | |
label="Upload Single File" | |
uploadFileName="theFiles" | |
onChange={onChange} | |
/> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment