Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger the Dropzone.js' default file upload input?

I'd like to know how to trigger the Dropzone.js' default file upload input? It's not as simple like this:

window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");

Now i don't have any ideas. Anyway the whole #dropCloud container is hidden, if it matters.

like image 742
Répás Avatar asked Jun 29 '14 15:06

Répás


People also ask

How to upload file using dropzone JS and jQuery without refreshing?

Follow following the below steps and upload file using dropzone js and jquery without refreshing the whole web page in PHP: First of all, create an index.php file and update the below HTML code into your index.php file. This HTML code shows the image upload form, so using this form you can upload the images on the DB table and project folder.

How to submit Form to controller from dropzone?

Now, Click on Submit button, to submit form (you can add more more values), you will receive files in your controller, take a look at the below image, which shows that two files name "pdf.pdf" and "meditation.jpg" has been posted to C# Controller from Dropzone.

How do I handle drag and drop files in dropzone?

Ultimately, the logic to select or handle the drag and drop files and upload them to the server will be contained within the DropZone.js file. Import the DropZone component from the components directory and add it to the index.js file in the pages directory. The index.js file will be used to render the application.

How to add a dropzone in WordPress form?

Create a <form > element where add class='dropzone' and set action='upload.php'. From upload.php file handle file upload when a file is selected. 3. PHP Create a new upload folder for storing files and a upload.php file. Use move_uploaded_file () method to store the file to upload directory. 4. CSS Create a style.css file. 5. Demo 6. Conclusion


1 Answers

This seems to work great for me

var dropZone = new Dropzone($("#yourdropzonedivthinger").get(0), {
BLAH BLAH BLAH drop zone init stuff
});

//Call this anywhere in your code to manually trigger the dropzone file dialog popup thinger

dropZone.hiddenFileInput.click();
like image 112
Dave Geurts Avatar answered Oct 19 '22 23:10

Dave Geurts