您好,我需要使用http://www.dropzonejs.com/在我的XPages中上传文件。
我考虑过要使用XAgent处理Mark Leusink:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler
但是,我总是遇到问题500(不是文件)的问题!异常(exception)....
似乎控件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
});
});
最佳答案
可以用此代码解决
$(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
});
});
关于xpages - dropzonejs和XPages上传,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33945658/