Question

fine uploader has allowedExtensions validation, but doesn't have disallowedExtensions. I want to disallow specific 2 or 3 extensions.

I can do it by php, but I want to prevent it before loading files.

How can I do it?

Was it helpful?

Solution

You can easily enforce any restrictions you want in Fine Uploader using the onValidate, onValidateBatch, and/or onSubmit callbacks.

For example, to exclude any files with a .txt extension:

var uploader = new qq.FineUploader({
    callbacks: {
        onSubmit: function(id, name) {
            return qq.getExtension(name) !== "txt";
        }
    }
});

There is also an outstanding pull request to add a disallowedExtensions property to the validation option, but this is not currently a high priority, as it's quite easy to enforce extensions this way via callbacks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top