Created
November 14, 2020 01:38
-
-
Save ctrlaltdylan/fa61bd991b7b1f484bdb15e153755920 to your computer and use it in GitHub Desktop.
Browser Axios Cloudinary Upload
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
let formData = new FormData(); | |
formData.append("upload_preset", "<your preset from Cloudinary Dashboard here> * Required"); | |
formData.append("file", <instance of a File here>); | |
axios | |
.post( | |
"https://api.cloudinary.com/v1_1/<your Cloudinary cloud name here>/image/upload", | |
formData, | |
{ | |
headers: { | |
"X-Requested-With": "XMLHttpRequest", | |
}, | |
} | |
) | |
.then((res) => { | |
debugger; | |
}) | |
.catch((err) => { | |
console.log(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment