Laravel Dropzone和另一个输入类型文件?

Laravel Dropzone和另一个输入类型文件?,laravel,laravel-5,laravel-5.2,dropzone.js,Laravel,Laravel 5,Laravel 5.2,Dropzone.js,这是我的dropzone配置: $this->validate($request,[ 'default_image' => 'mimes:jpeg,bmp,png|max:2000' ]); 您需要使用如下规则: Dropzone.options.myDropzone = { // The camelized version of the ID of the form element // The configuratio

这是我的dropzone配置:

  $this->validate($request,[
             'default_image' => 'mimes:jpeg,bmp,png|max:2000'
          ]);

您需要使用如下规则:

Dropzone.options.myDropzone = { // The camelized version of the ID of the form element

    // The configuration we've talked about above
    addRemoveLinks: true,
    previewsContainer: '.dropzone-previews',
    autoProcessQueue: false,
    uploadMultiple: true,
    parallelUploads: 10,
    maxFiles: 10,
    autoDiscover:false,
    paramName:'gallery_images',

    // The setting up of the dropzone
    init: function() {
        var myDropzone = this;

        // First change the button to actually tell Dropzone to process the queue.
        this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
            // Make sure that the form isn't actually being sent.
            if (myDropzone.getQueuedFiles().length > 0) {

                e.preventDefault();
                e.stopPropagation();
                myDropzone.processQueue();
            }
        });

        // Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
        // of the sending event because uploadMultiple is set to true.
        this.on("sendingmultiple", function() {
            console.log('sendingmultiple');
            // Gets triggered when the form is actually being sent.
            // Hide the success button or the complete form.

        });
        this.on("successmultiple", function(files, response) {
            console.log('successmultiple error',response);
            // Gets triggered when the files have successfully been sent.
            // Redirect user or notify of success.
            $("html, body").animate({ scrollTop: 0 }, "slow");
            $("#resultMsg").css('display', 'block').text(response.successMsg);

        });
        this.on("errormultiple", function(files, response) {
          console.log('response error',response);
            // Gets triggered when there was an error sending the files.
            // Maybe show form again, and notify user of error
        });
    }

};
有关详细信息:

Dropzone.options.myDropzone = { // The camelized version of the ID of the form element

    // The configuration we've talked about above
    addRemoveLinks: true,
    previewsContainer: '.dropzone-previews',
    autoProcessQueue: false,
    uploadMultiple: true,
    parallelUploads: 10,
    maxFiles: 10,
    autoDiscover:false,
    paramName:'gallery_images',

    // The setting up of the dropzone
    init: function() {
        var myDropzone = this;

        // First change the button to actually tell Dropzone to process the queue.
        this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
            // Make sure that the form isn't actually being sent.
            if (myDropzone.getQueuedFiles().length > 0) {

                e.preventDefault();
                e.stopPropagation();
                myDropzone.processQueue();
            }
        });

        // Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
        // of the sending event because uploadMultiple is set to true.
        this.on("sendingmultiple", function() {
            console.log('sendingmultiple');
            // Gets triggered when the form is actually being sent.
            // Hide the success button or the complete form.

        });
        this.on("successmultiple", function(files, response) {
            console.log('successmultiple error',response);
            // Gets triggered when the files have successfully been sent.
            // Redirect user or notify of success.
            $("html, body").animate({ scrollTop: 0 }, "slow");
            $("#resultMsg").css('display', 'block').text(response.successMsg);

        });
        this.on("errormultiple", function(files, response) {
          console.log('response error',response);
            // Gets triggered when there was an error sending the files.
            // Maybe show form again, and notify user of error
        });
    }

};
$this->validate($request,[
    'default_image.*' => 'mimes:jpeg,bmp,png|max:2000'
]);