Anyone familiar with dropzonejs?

Dropzone.options.dropzone = {
    uploadMultiple : false,
    maxFiles : 1,
    maxFilesize: 5, // MB
    init: function () {
        this.on("success", function(file, response) {
            if( response.num_color_error ) {
                this.removeFile(file);
            }else {
                window.location.href = '/palette/' + response;
            }
        });
        this.on("maxfilesexceeded", function(file) {
            this.removeFile(file)
        });
    }
};

I’m building an app that extracts colors from an image file. It must have at least two colors before it will work and I’m passing back a json response error if it finds only a single color. So, if it only finds a single color, i.e., if response.num_color_error, then it will remove the file so the user can start over. My problem is that I cannot for the life of me figure out how to also display the “error” icon that ships with dropzone and the red comment bubble which dropzone defaults to which holds error messages? I assume it’s possible to call these things on command, but I see nothing in the docs that explains it? If there’s a num_color_error, I’d like to show the “error” icon, with the comment bubble explaining why and then give the user the option to remove the image and start over (which I know how to do that last bit).

The second thing I’m not clear on is the “this.removeFile(file)” part. I found that in their documentation as an example for how to remove the file. It works, but my problem is that I don’t see anything else in their docs (in like the events or configuration options) and mentions a “removeFile” method or event. How would someone put the pieces together from their docs in order to understand that “this.removeFile(file)” was even an option had they not explicitly said so in their docs? I’m just trying to understand how to read their docs better so I can start to sort this stuff out on my own.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.