Skip to content

Instantly share code, notes, and snippets.

@godswillokokon
Created March 27, 2020 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save godswillokokon/5e942ae9ae8ad4eb94aad3b15f0df6d8 to your computer and use it in GitHub Desktop.
Save godswillokokon/5e942ae9ae8ad4eb94aad3b15f0df6d8 to your computer and use it in GitHub Desktop.
const cloudinaryUpload = (photo) => {
const data = new FormData()
data.append('file', photo)
data.append('upload_preset', 'ogcodes')
data.append("cloud_name", "ogcodes")
fetch("https://api.cloudinary.com/v1_1/ogcodes/upload", {
method: "post",
body: data
}).then(res => res.json()).
then(data => {
setPhoto(data.secure_url)
}).catch(err => {
Alert.alert("An Error Occured While Uploading")
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment