-1

I am planning to use dropzone and I am new to it, I am reading some documents

I am planning to use dropzone for the UI and uploading into server, using some other API's, so how do I tell dropzone to use my custom method and pass the success or failure to the UI

I found some other interesting posts like thisenter link description here

Community
  • 1
  • 1
mkk
  • 21
  • 1
  • In the options init function I am doing this, this.on("sending", function(file, xhr, formData){ debugger; saveFiletoServer(file, 'account'); //Custom method }); so the file is saving as needed, but how do I tell Dropzone the file is successful, it is throwing an error in UI. – mkk Aug 31 '16 at 15:33

1 Answers1

0

You could set the init() function and wait for the response:

Dropzone.options.dropzoneForm = {
    init: function () {
        this.on("complete", function (data) {
             var res = JSON.parse(data.xhr.responseText); 
             //use the request's statusCode anyway you want to
             if(data.xhr.status === 200)
             {
                //modify the UI
             }
        });
    }
    dictResponseError: "error message when failed"
};

HTTP Status Codes

Jose Cordero
  • 526
  • 5
  • 15