omidparkour
2 years ago

use Dropzone with Laravel

Posted 2 years ago by omidparkour

Hi

i have a form for create a post and i want to add multi photo in this form and use dropzone

but now doesn't work good

i wrote following codes:

     var myDropzone = new Dropzone("#image-upload", {
                paramName:'file',
                autoProcessQueue: false,
                url: "/admin/product/store",
                uploadMultiple:true,
                maxFilesize: 1,
                maxFiles: 3,
                acceptedFiles: ".jpeg,.jpg,.png,.gif",
                
                init: function() {
                    var submitButton = document.querySelector("#submitProductForm");
                    myDropzone = this; // closure

                    submitButton.addEventListener("click", function(e) {
                        myDropzone.processQueue(); // Tell Dropzone to process all queued files.
                    });

                    // You might want to show the submit button only when
                    // files are dropped here:
                    this.on("addedfile", function() {
                        // Show submit button here and/or inform user to click it.
                    });

                }
            });

and so when dd($request->file('file')) display null

what to do now?

Please sign in or create an account to participate in this conversation.