-
-
Save basicallydan/11c8c02bdaa1ced2e842 to your computer and use it in GitHub Desktop.
Upload from the browser to Cloudinary with no server
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
<!-- This example is for a blog post that can be found at http://danhough.com/blog/dropzone-cloudinary/ - read there to find out how to use it --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Dropzone Example</title> | |
</head> | |
<body> | |
<div id="dropzone-area" style="width:700px;height:700px;display:block;margin:20px auto;border:1px solid red;"></div> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.0.1/dropzone.js"></script> | |
<script type="text/javascript"> | |
var myDropzone = new Dropzone(document.getElementById('dropzone-area'), { | |
uploadMultiple: false, | |
acceptedFiles:'.jpg,.png,.jpeg,.gif', | |
parallelUploads: 6, | |
url: 'https://api.cloudinary.com/v1_1/cloud9/image/upload' | |
}); | |
myDropzone.on('sending', function (file, xhr, formData) { | |
formData.append('api_key', 123456789123456); | |
formData.append('timestamp', Date.now() / 1000 | 0); | |
formData.append('upload_preset', 'presetname'); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome! exactly what i needed. thx