Why Blueimp's JQuery File Upload add all prev. selected files even if options [replaceFileInput: false] and [maxNumberOfFiles: 1] are set on init?

后端 未结 1 1761
春和景丽
春和景丽 2021-01-05 05:32

I have just normal form with some input fields and one file input field. I use the Blueimp\'s Jquery File Upload plugin to upload a file. It seems to work, if you select a f

1条回答
  •  鱼传尺愫
    2021-01-05 06:10

    I had the same problem, my solution was to unbind the click event of my button and bind it back whenever the add event is called. Try This.

    ...

    add: function (e, data) {
    
            $('#upload_button').unbind('click');
            data.context = $('#upload_button').bind('click', function () {
                        ...
                        data.submit();
            }
    }
    

    0 讨论(0)
提交回复
热议问题