Skip to content

Instantly share code, notes, and snippets.

@ramontayag
Created November 5, 2010 06:33
Show Gist options
  • Save ramontayag/663736 to your computer and use it in GitHub Desktop.
Save ramontayag/663736 to your computer and use it in GitHub Desktop.
$(function () {
/* Attachment form */
$("form#new_attachment").ajaxForm({dataType: 'script'});
$("form#new_attachment :file").change(function() {
var uploadId = new Date().getTime();
$('#attachment-list').append('<li id="upload_id_' + uploadId + '">' + this.value + ' <span>(uploading...)</span></li>');
$('form#new_attachment input#upload_id').val("upload_id_" + uploadId);
$(this).closest('form#new_attachment').submit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment