Get filename from input [type='file'] using jQuery

前端 未结 11 1020
陌清茗
陌清茗 2020-12-23 20:15

This is the uploaded form.

11条回答
  •  無奈伤痛
    2020-12-23 20:28

    You have to do this on the change event of the input type file this way:

    $('#select_file').click(function() {
        $('#image_file').show();
        $('.btn').prop('disabled', false);
        $('#image_file').change(function() {
            var filename = $('#image_file').val();
            $('#select_file').html(filename);
        });
    });​
    

提交回复
热议问题