Dan*_*llo 6 xpages xpages-ssjs
您好我需要在我的XPage中使用http://www.dropzonejs.com/上传文件.我想过使用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(); }
}
}
});
Run Code Online (Sandbox Code Playgroud)
有人有建议吗?
谢谢!
UPDATE
我解决了!问题是程序化使用这是正确的
$(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
});
});
Run Code Online (Sandbox Code Playgroud)
好的,用这段代码解决了
$(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
});
});
Run Code Online (Sandbox Code Playgroud)