我正在尝试将Dropzone.js
实施到自定义CMS中。我在PHP中根据需要处理文件没有问题,这实际上很容易。
我需要知道如何逐页进行以下操作(将在几个页面中使用dropzone脚本用于不同的功能):
我可以在页面底部添加此内容,同时解决设置问题:
<script src="../assets/global/plugins/dropzone/dropzone.js"></script>
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
Metronic.init(); // init metronic core components
Layout.init(); // init current layout
Demo.init(); // init demo features
FormDropzone.init();
});
</script>
答案 0 :(得分:0)
HTML:
<div id="my-dropzone"></div>
JavaScript的:
var initDropzone = function( filesAllowed ){
Dropzone.options.myDropzone = {
paramName: "file",
uploadMultiple: true,
maxFiles: filesAllowed, //this will need to be set upon init,
acceptedFiles: ['image/jpeg', 'image/jpg', 'application/pdf'],
complete: function() {
alert('Your file was successfully uploaded!');
}
};
}
//init the dropzone
initDropzone( 4 );