dropzone js onclick submit file upload

前端 未结 5 1589
时光说笑
时光说笑 2020-12-24 02:11

upload all files with a single button click.
HTML:

5条回答
  •  悲哀的现实
    2020-12-24 02:45

    I accomplished this by placing my dropzone in a div instead of a form, thereby removing the ability for dropzone to automatically POST the uploads to a given URL. The URL I passed to the dropzone instance when I created it is literally 'dummy' since it will never be called. For example, HTML

    
    

    JavaScript

    $('#submit-all').on('click', function() {
        var files = $('#my-dropzone').get(0).dropzone.getAcceptedFiles();
        // Do something with the files.
    });
    

提交回复
热议问题