33 lines
913 B
HTML
33 lines
913 B
HTML
|
|
<script>
|
|
htmx.onLoad(function(elt){
|
|
if (Dropzone.instances.length == 0){
|
|
initDropzone();
|
|
}
|
|
});
|
|
|
|
|
|
function initDropzone () {
|
|
var dropzoneOptions = {
|
|
dictDefaultMessage: 'Déposez vos fichiers ici!',
|
|
paramName: "file",
|
|
maxFilesize: 1024, // MB
|
|
url: "{% if page %}/{{ page }}{% endif %}/upload-gallery/{{bloc.name}}",
|
|
chunking: true,
|
|
forceChunking: true,
|
|
chunkSize: 1000000,
|
|
autoProcessQueue: true,
|
|
init: function () {
|
|
this.on("success", function (file) {
|
|
console.log("success > " + file.name);
|
|
setTimeout(() => { this.removeFile(file); }, 2000);
|
|
});
|
|
}
|
|
};
|
|
var uploader = document.querySelector('#uploader');
|
|
var myDropzone = new Dropzone(uploader, dropzoneOptions);
|
|
console.log("Loaded");
|
|
};
|
|
</script>
|
|
|