Last active
December 24, 2015 18:49
-
-
Save JKring/6845782 to your computer and use it in GitHub Desktop.
async photo uploading
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
<script type="text/javascript"> | |
// You'll probably have to call this from $(document).ready because it requires the DOM to be loaded. | |
function bindToForm(){ | |
$("#upload-photo-form").fileupload({ | |
dataType: 'json', | |
progress: function() { | |
// Indicate that the upload has begun | |
}, | |
done: function(e, data) { | |
// use data.id, data.name, and data.url to display the photo | |
} | |
}); | |
}; | |
</script> | |
<form action="events/upload_photo" id="upload-photo-form"> | |
<input name="utf8" type="hidden" value="✓"> | |
<input name="authenticity_token" type="hidden" value="<%= form_authenticity_token %>"> | |
<input name="event_id" type="hidden" value="<%= @event.id %>"> | |
<input name="file" type="file"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment