Dropzone功能不起作用。 [英] Dropzone function not working.
问题描述
你好。
我使用的是WordPress插件来使用Dropzone,默认安装工作正常,但我想添加在继续之前确定图像是否已经上传的代码,但我似乎无法使其工作。
这是我的自定义dropzone.js。
Hello.
I am using a WordPress plugin to use Dropzone, the default installation works fine but I am trying to add code to determine if an image has been already uploaded before proceeding but I can't seem to get it to work.
Here is my custom dropzone.js.
Dropzone.options.dropzoneWordpressForm = {
acceptedFiles: ".jpg", // only .jpg files
maxFiles: 20,
uploadMultiple: true,
preventDuplicates: true,
dictDuplicateFile: "Duplicate Files Cannot Be Uploaded",
maxFilesize: 5, // 5 MB
addRemoveLinks: false,
dictRemoveFile: 'X (remove)',
init: function() {
this.on("sending", function(file, xhr, formData) {
formData.append("name", "value"); // Append all the additional input data of your form here!
});
}
};
这里的代码与我发现的代码相同网络。
and here is the same code with added code I found from the web.
Dropzone.options.dropzoneWordpressForm = {
acceptedFiles: ".jpg", // only .jpg files
maxFiles: 20,
uploadMultiple: true,
preventDuplicates: true,
dictDuplicateFile: "Duplicate Files Cannot Be Uploaded",
maxFilesize: 5, // 5 MB
addRemoveLinks: false,
dictRemoveFile: 'X (remove)',
init: function() {
this.on("sending", function(file, xhr, formData) {
formData.append("name", "value"); // Append all the additional input data of your form here!
});
myDropzone.on("addedfile", function(file) {
if (this.files.length) {
var _i, _len;
for (_i = 0, _len = this.files.length; _i < _len - 1; _i++) {
if( this.files[_i].name === file.name ) {
this.removeFile(file);
}
}
}
});
}
};
如果需要,这里是我的表格代码。
here is my form code if it's needed.
<div id="dropzone-wordpress"><form action="$url" class="dropzone needsclick dz-clickable multiple" id="dropzone-wordpress-form">
$nonce_files
<div class="dz-message needsclick">
Drop files here or click to upload.
</div>
<input type='hidden' name='action' value='submit_dropzonejs'>
</form></div>
非常感谢任何帮助。
我尝试过:
我试过搜索谷歌。
Any help is greatly appreciated.
What I have tried:
I have tried searching google.
推荐答案
url class = dropzone needsclick dz-clickable multiple id = dropzone-wordpress-form >
url" class="dropzone needsclick dz-clickable multiple" id="dropzone-wordpress-form">
nonce_files
< div class = dz-message needsclick >
在此处删除文件或点击上传。
< / div >
< input type =' hidden' name =' 操作 值 =' submit_dropzonejs' >
< / form > < / div >
nonce_files <div class="dz-message needsclick"> Drop files here or click to upload. </div> <input type='hidden' name='action' value='submit_dropzonejs'> </form></div>
非常感谢任何帮助。
我尝试过:
我试过搜索谷歌。
Any help is greatly appreciated.
What I have tried:
I have tried searching google.
这篇关于Dropzone功能不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!