显示服务器上的现有文件,限制文件数量和其他功能
Dropzone.js v4+ - Display existing files on server with work limiting the number of files and other functions
如何将服务器上的现有文件添加到具有正确工作的所有功能和正确样式的dropzone ?
我写了一个函数来添加文件:addCustomFile(file, thumbnail_url, response)
支持版本:4.0.1 stable
正确工作:maxFiles limit, event maxfilesexceeded, event success and others
$("#dropzone-images").dropzone({
url: "...",
paramName: 'image_temp',
maxFiles: 1,
init: function () {
this.addCustomFile = function(file, thumbnail_url , responce){
// Push file to collection
this.files.push(file);
// Emulate event to create interface
this.emit("addedfile", file);
// Add thumbnail url
this.emit("thumbnail", file, thumbnail_url);
// Add status processing to file
this.emit("processing", file);
// Add status success to file AND RUN EVENT success from responce
this.emit("success", file, responce , false);
// Add status complete to file
this.emit("complete", file);
}
this.addCustomFile(
// File options
{
// flag: processing is complete
processing: true,
// flag: file is accepted (for limiting maxFiles)
accepted: true,
// name of file on page
name: "The name",
// image size
size: 12345,
// image type
type: 'image/jpeg',
// flag: status upload
status: Dropzone.SUCCESS
},
// Thumbnail url
"http://.../img.jpg",
// Custom responce for event success
{
status: "success"
}
);
}
});
相关文章:
- 点击功能无法处理我的所有文件
- 快速.JS无法识别所需的js文件的功能
- 包括从外部文件到HTML的查询功能(使用Dropbox进行本地测试)
- plupload添加文件功能
- 从文件目录结构创建JSON数据的有效功能
- MEANJS用户配置文件功能
- jQuery文件下载插件总是在失败功能
- 文件上传功能会显示 Safari 和 Chrome iOS8.1.2 上带有空字符串的数据
- 是否可以在js脚本中包含php文件并访问该php文件的功能
- 纯JavaScript或jQuery文件下载功能
- 我们可以在茉莉花中包含 php 文件并使用它们的功能吗 .
- 谷歌应用脚本 - 将一些功能移动到单独的文件中
- 如何使用 MVC4 C# 禁用 iframe 中的打印功能和只读文件
- 带有文件上传功能的 AngularJs Ajax POST 表单
- 一个 PHP 文件中有两个事件功能
- 是否可以访问同一文件中的其他模块导出功能
- 在IE中下载文件时运行功能
- Spring AngularJS上传文件功能-400错误错误请求错误
- Chrome扩展如何每2秒运行一次后台文件功能
- Cordova/Phonegap文件功能不起作用