Created
October 4, 2016 16:07
-
-
Save NickDeckerDevs/4e3b97d3e6d9a1f31fa5471153e7ec8a to your computer and use it in GitHub Desktop.
How to append the name of a file if you are replacing the normal functionality of a file upload button
This file contains hidden or 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
$(window).load(function() { | |
$('input[type=file]').on('change', function() { | |
var filename = $(this).val().split('\\'); | |
if($('#filename-information').length > 0) { | |
$('#filename-information').html('Selected File: '+filename[filename.length - 1]); | |
} else { | |
$(this).parent().append('<div id="filename-information">Selected File: '+filename[filename.length - 1]+'</div>'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
used this as a guideline: http://www.htmllion.com/custom-file-input-styling-with-css.html