How do I preload images into dropzone.js

Proper way to do it is to use .emit method provided by on dropzone js to add a file and thumbnail to preload images from the server. See sample code below. Taken from https://github.com/enyo/dropzone/wiki/FAQ#how-to-show-files-already-stored-on-server // Create the mock file: var mockFile = { name: “Filename”, size: 12345 }; // Call the default addedfile event handler … Read more

Dropzone Submit Button on Upload

You need to: Add a button: <button type=”submit” id=”button” class=”btn btn-primary”>Submit</button> Tell Dropzone not to automatically upload the file when you drop it, as it will by default. That’s done with the autoProcessQueue config option: autoProcessQueue: false Since Dropzone will now not auto-upload the files, you need to manually tell it to do that when … Read more

Sending additional parameter with dropzone.js

You can append data along with the formdata $(“div#dropzone_profile_photo”).dropzone({ url: “/file-upload/”, init: function() { this.on(“sending”, function(file, xhr, formData){ formData.append(“data”, “loremipsum”); }); } }); $(“div#dropzone_profile_photo”).dropzone({ url: “/test”, init: function() { this.on(“sending”, function(file, xhr, formData) { formData.append(“data”, “loremipsum”); console.log(formData) }); } }); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <script src=”https://rawgit.com/enyo/dropzone/master/dist/dropzone.js”></script> <link rel=”stylesheet” href=”https://rawgit.com/enyo/dropzone/master/dist/dropzone.css”> <div id=”dropzone_profile_photo” style=”width:400px;height:400px; background-color:blue”></div>

How to include the CSRF token in the headers in Dropzone upload request?

Okay so this code is working just fine now: $(“#mydropzone”).dropzone({ url: “/profile/update-photo”, addRemoveLinks : true, maxFilesize: 5, dictDefaultMessage: ‘<span class=”text-center”><span class=”font-lg visible-xs-block visible-sm-block visible-lg-block”><span class=”font-lg”><i class=”fa fa-caret-right text-danger”></i> Drop files <span class=”font-xs”>to upload</span></span><span>&nbsp&nbsp<h4 class=”display-inline”> (Or Click)</h4></span>’, dictResponseError: ‘Error uploading file!’, headers: { ‘X-CSRF-TOKEN’: $(‘meta[name=”token”]’).attr(‘content’) } }); So basically I needed to add the X-CSRFToken in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)