Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const uploadImage = async e => {
- const files = e.target.files
- const data = new FormData()
- data.append('file', files[0])
- data.append('upload_preset', 'book-alike')
- setLoading(true)
- const res = await fetch(
- 'https://api.cloudinary.com/v1_1/perninio/image/upload',
- {
- method: 'POST',
- body: data
- }
- )
- const file = await res.json()
- console.log(file.secure_url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement