<script type="text/javascript"> $(document).on('change', '#bac (document).on('change', '#file', function() { var input = $(this), numFiles = input.get(0).files ? input.get(0).files.length : 1, label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); $('#file_label').val(label); }); </script> <input id="file" name="file" type="file"> <input id="file_label" name="file_label" type="text" readonly="">