我的 ajax 过程在 dropzone js 重复

My ajax process is repeating at dropzone js

我需要数据库中图像的一些细节。我正在使用 dropzone js 进行上传。当我执行多个 ajax 时出现问题。第一次执行后,每次它再次添加相同的数据。 dropzone 正常工作

例如 首先 post 添加一个数据 - second post 添加两个数据 - 第三个post 添加三个数据

Dropzone.options.seferekle = {
    paramName: "file",
    parallelUploads : 1,
    acceptedFiles: '.jpg,.jpeg,.JPEG,.JPG,.png,.PNG',
    autoProcessQueue : false,
    addRemoveLinks : true,
    init: function() {

        myDropzone = this;

        $('.post').on('click', function(event){

            tarih = $("input[name=tarih]").val();

            if(!tarih)
            {
                alert("Sefer Tarihi ve Sefer Türü Alanları Boş Bırakılamaz.");
            }
            else
            {
                myDropzone.processQueue();

                myDropzone.on("success", function(file, responseText) {
                    newImgName= responseText;

                    $.ajax({
                        url: "http://localhost/vipumre/App/Model/add.php",
                        data: "image_name="+newImgName+"&tarih="+tarih,
                        type: "post",

                        success: function(data) {
                            $('.return').show();
                            $('.return').text(data);
                        },

                        error: function() {
                            $('.return').show();
                            $('.return').text("Ajax Error");
                        }

                    }); //Ajax End

                    myDropzone.on("complete", function(file,done) {
                        this.removeAllFiles(true);
                        done();
                    })

                });

            }

        });

    } //Dropzone init End

}; //Dropzone End

如果您想在上传文件时发送数据,您应该使用发送事件:

Dropzone.options.seferekle = {

    init: function (e) {

        var myDropzone = this;

        // Event to send your custom data to your server
        myDropzone.on("sending", function(file, xhr, data) {

            // First param is the variable name used server side
            // Second param is the value, you can add what you what
            // Here I added an input value
            data.append("your_variable", $('#your_input').val());
        });

    }
};