dropzonejs 和 XPages 上传
dropzonejs and XPages upload
您好,我需要使用 http://www.dropzonejs.com/ 在我的 XPages 中上传文件。
我考虑过使用 XAgent 来处理 Mark Leusink:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler
但我总是遇到问题错误 500 那不是一个文件!异常....
好像是控制DropZone js不发送带参数的文件,我没看懂Firebug
DropZone 非常简单...
$(function () {
// $("div#FileIDUpload").dropzone({ url: "xUpload.xsp" });
var myDropzone = new Dropzone("div#FileIDUpload", { url: "xUpload.xsp"});
Dropzone.options.myAwesomeDropzone = {
paramName: "uploadedFile", // The name that will be used to transfer the file
clickable:true,
uploadMultiple:false,
maxFilesize: 2, // MB
accept: function(file, done) {
if (file.name == "justinbieber.jpg") {
done("Naha, you don't.");
}
else { done(); }
}
}
});
有人有建议吗?
谢谢!
更新
我解决了!
问题是程序化使用
这是正确的
$(function () {
// $("div#FileIDUpload").dropzone({ url: "xUpload.xsp" });
var myDropzone = new Dropzone("div#FileIDUpload", {
paramName: "uploadedFile", // The name that will be used to transfer the file
url: "xUpload.xsp",
clickable:true,
uploadMultiple:false,
maxFilesize: 2 // MB
});
});
OK 已经用这段代码解决了
$(function () {
// $("div#FileIDUpload").dropzone({ url: "xUpload.xsp" });
var myDropzone = new Dropzone("div#FileIDUpload", {
paramName: "uploadedFile", // The name that will be used to transfer the file
url: "xUpload.xsp",
clickable:true,
uploadMultiple:false,
maxFilesize: 2 // MB
});
});
您好,我需要使用 http://www.dropzonejs.com/ 在我的 XPages 中上传文件。 我考虑过使用 XAgent 来处理 Mark Leusink:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler
但我总是遇到问题错误 500 那不是一个文件!异常....
好像是控制DropZone js不发送带参数的文件,我没看懂Firebug
DropZone 非常简单...
$(function () {
// $("div#FileIDUpload").dropzone({ url: "xUpload.xsp" });
var myDropzone = new Dropzone("div#FileIDUpload", { url: "xUpload.xsp"});
Dropzone.options.myAwesomeDropzone = {
paramName: "uploadedFile", // The name that will be used to transfer the file
clickable:true,
uploadMultiple:false,
maxFilesize: 2, // MB
accept: function(file, done) {
if (file.name == "justinbieber.jpg") {
done("Naha, you don't.");
}
else { done(); }
}
}
});
有人有建议吗?
谢谢!
更新
我解决了! 问题是程序化使用 这是正确的
$(function () {
// $("div#FileIDUpload").dropzone({ url: "xUpload.xsp" });
var myDropzone = new Dropzone("div#FileIDUpload", {
paramName: "uploadedFile", // The name that will be used to transfer the file
url: "xUpload.xsp",
clickable:true,
uploadMultiple:false,
maxFilesize: 2 // MB
});
});
OK 已经用这段代码解决了
$(function () {
// $("div#FileIDUpload").dropzone({ url: "xUpload.xsp" });
var myDropzone = new Dropzone("div#FileIDUpload", {
paramName: "uploadedFile", // The name that will be used to transfer the file
url: "xUpload.xsp",
clickable:true,
uploadMultiple:false,
maxFilesize: 2 // MB
});
});