6

Hello I need to use http://www.dropzonejs.com/ for upload file in my XPages. I thought about using to use the XAgent for handle Mark Leusink:

http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler

But always I have problem error 500 that's not a file! exception....

it seems that control DropZone js not send the file with the parameter, I do not understand with Firebug

DropZone is very simple...

$(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(); }
   }
  }
});

Someone have suggestion?

Thanks!

UPDATE

I've solve! the problem is the programmatic use this is correct

$(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

   });


});
Daniele Grillo
  • 1,011
  • 4
  • 13
  • 31
  • 1
    This seems like a very useful question, I think you should answer your own question, so that others will easier see that it is solved. – Steve Zavocki Nov 27 '15 at 15:06
  • You already answered the question yourself, but I decided to publish the demo database anyway: http://linqed.eu/2015/11/28/dropzone-js-in-xpages-it-doesnt-get-easier-than-this/ – Mark Leusink Nov 28 '15 at 09:43
  • As Steve said it would be good if you posted the solution as an answer to your own question, and then mark it as the accepted answer – Brian Gleeson - IBM Jan 11 '16 at 14:59

1 Answers1

0

OK In have solve with this code

    $(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

   });


});
Daniele Grillo
  • 1,011
  • 4
  • 13
  • 31
  • Any suggestion on how to upload multiple files into one rich text field in document? For example, changing "uploadMultiple: true" returns errors, because the java code only takes in one at a time. Would it be better to use the dropzone methods first (e.g. "processMultiple"), or update the code in java? Any guidance would be greatly appreciated. – Steve Cochrane Apr 30 '18 at 15:28