Skip to content

Instantly share code, notes, and snippets.

@rtablada
Created March 22, 2014 23:38
Show Gist options
  • Save rtablada/9716101 to your computer and use it in GitHub Desktop.
Save rtablada/9716101 to your computer and use it in GitHub Desktop.
Allow awesome uploaders in Gumby
<div class="append field fancy-uploader">
<input type="text" class="input xwide" placeholder="File">
<input type="file" name="picture">
<div class="primary btn medium">
<button>Upload</button>
</div>
</div>
(function(){
$('.fancy-uploader').on('click', '.btn', function(ev) {
ev.preventDefault();
$(this).siblings('input[type=file]').click();
});
$('.fancy-uploader').on('change', 'input[type=file]', function(ev) {
file = this.files[0];
$textBox = $(this).siblings('input[type=text]').first();
$textBox.val(file.name);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment