I have been looking through several SO posts and blogs on the Internet, but cannot find anything that works.
I am trying to create a simple HTML drag and drop form where users can upload multiple files at once through DropzoneJS.
HTML:
<form action='<?php echo url_for("@menu_basic_menu"); ?>' method="post" enctype="multipart/form-data" class="dropzone" id="basic_menu_dropzone"></form>
<button id="file_submit_btn" type="submit" form='basic_menu_dropzone' value="submit">SUBMIT</button>
JavaScript:
jQuery(document).ready(function($) {
Dropzone.autoDiscover = false;
var dropzone = new Dropzone('#basic_menu_dropzone', {
paramName: 'files',
addRemoveLinks: true,
uploadMultiple: true,
autoProcessQueue: false,
});
$('#file_submit_btn').click(function() {
dropzone.processQueue();
});
});
Here you will notice that I also created a submit button so that we only begin the process of uploading files when sending
PHP (snippet of actions.class.php):
public function executeBasicMenu(sfWebRequest $request) {
if ($request->isMethod('post')) {
print_r_tree($_FILES);
}
}
I have all the settings, so executeBasicMenu runs correctly on submit, but $ _FILES always returns an empty array.
Notes:
- If I replaced the dropzone form with the usual input type = 'file' tag, then everything will work, so my gut feeling tells me that my dropzone configuration is somewhere wrong.
- dropzone.js, , 1386: xhr.send(formData),
formData .
!