Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const onFileChange = event => {
- const formData = new FormData()
- const image = {
- type: 'image/jpeg'
- }
- const blob = new Blob([event.target.files[0]], image)
- formData.append('file', blob)
- axios.post('http://localhost:3334/api/v1/fileupload/images', formData, {
- headers: {
- 'Content-Type': 'multipart/form-data; ',
- }
- })
- .then(response => {
- console.log('response =>', response)
- })
- .catch(err => {
- console.log('err =>', err)
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement