Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upload from the browser to Cloudinary with no server
<!-- 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>
@bobmoff

This comment has been minimized.

Copy link

@bobmoff bobmoff commented Mar 15, 2017

awesome! exactly what i needed. thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment