Skip to content

Instantly share code, notes, and snippets.

@steve-ross
Created October 21, 2012 13:46
Show Gist options
  • Save steve-ross/3927019 to your computer and use it in GitHub Desktop.
Save steve-ross/3927019 to your computer and use it in GitHub Desktop.
Upload a file in couchdb with jQuery
$('#upload_file').submit(function(e){
e.preventDefault();
var data = {};
$("form :file").each(function() {
data[this.name] = this.value; // file inputs need special handling
});
$(this).ajaxSubmit({
url: database_url + '/' + $('#_id').val() ,
dataType: 'json',
success: function(responseText, statusText, xhr, $form) {
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment