Created
July 27, 2018 21:09
-
-
Save DavyBello/4f900714f5e75ad9790622056bdcab43 to your computer and use it in GitHub Desktop.
This file contains 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
const uploadPreset = 'yxp8krwl'; | |
const cloudName = 'dgq5corvs'; | |
let file; //from upload button | |
const formData = new FormData(); | |
formData.append('file', file); | |
formData.append('upload_preset', uploadPreset); | |
try { | |
const response = await axios.post( | |
`https://api.cloudinary.com/v1_1/${cloudName}/image/upload`, | |
formData, | |
); | |
console.log(response); | |
//do api post to save file details to db | |
} catch (e) { | |
console.log(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment