Skip to content

Passing additional uploaderOptions to DropZone #69

Description

@damanic

DropZone supports a number of options, why aren't these options being passed through init ?

The issue can be seen here:

    FileUpload.prototype.bindUploader = function() {
        this.uploaderOptions = {
            url: this.options.url,
            paramName: this.options.paramName,
            clickable: this.$uploadButton.get(0),
            previewsContainer: this.$filesContainer.get(0),
            maxFiles: !this.options.isMulti ? 1 : null,
            headers: {}
        }
...
   this.dropzone = new Dropzone(this.$el.get(0), this.uploaderOptions)

Only two options are passed through to Dropzone directly on init

  • url
  • paramName

This plugin would be more flexible on frontend if we could pass dropzone options as part of the fileUploader init.

Use case Example: I want my single image uploaders to offer more than one clickable upload element, and I would like to override the default onClickSuccessObject behaviour. This would be easily done if we had a more flexible constructor and some events that allow default behaviour to be overridden.

Example of how one might expect to implement this on construct:

        var singleImageUploader = $('.singleImageUploader ').fileUploader({
            isMulti : false
            dropzoneOptions : {
                clickable : [ '.button', '.image-container' ]
            },
        });

        singleImageUploader .on('onClickSuccessObject', function(ev){
             //do something other than opening the uploaded file in a new window
        });

I cant see a straight forward way to do this using the fileUploader as is. Have I missed something, or is the fileUploader obj being unnecessarily restrictive?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions