Using Dropzone.js to upload after new user creation, send headers

前端 未结 2 1813
闹比i
闹比i 2021-02-14 07:47

I\'m using a great plugin - dropzone.js (dropzonejs.com) to make my site a little more fancy when registering a new user.

Basically, the user fills out a form, drops a c

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-14 08:22

    I used enyo answer, but i used many dropzones with data-id attribute in my page so I used:

    $('div.dropzone').dropzone({
        url: 'img.php'
    });
    var sendingHandler = function(file, xhr, formData) {
        formData.append('id', $(this.element).data('id'));
    };
    $('div.dropzone').each(function() {
        Dropzone.forElement(this).on('sending', sendingHandler);
    });
    

提交回复
热议问题