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

   });


});
3
  • 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. Nov 27, 2015 at 15:06
  • You already answered the question yourself, but I decided to publish the demo database anyway: linqed.eu/2015/11/28/… Nov 28, 2015 at 9: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 Jan 11, 2016 at 14:59

1 Answer 1

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

   });


});
1
  • 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. Apr 30, 2018 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.