How to use the dropzone.options function in dropzone

To help you get started, we’ve selected a few dropzone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github roadiz / roadiz / themes / Rozier / Resources / app / components / documents / DocumentUploader.js View on Github external
})

                this.on('sending', function (file, xhr, formData) {
                    xhr.ontimeout = () => {
                        _self.options.onError('Server Timeout')
                        console.error('Server Timeout')
                    }
                })
            }
        }

        Dropzone.autoDiscover = this.options.autoDiscover

        try {
            /* eslint-disable no-new */
            new Dropzone(this.options.selector, Dropzone.options.uploadDropzoneDocument)

            let $dropzone = $(this.options.selector)
            $dropzone.append(`<div class="dz-default dz-message"><span>${this.options.dictDefaultMessage}</span></div>`)
            let $dzMessage = $dropzone.find('.dz-message')
            $dzMessage.append(`
            <div class="circles-icons">
                <div class="circle circle-1"></div>
                <div class="circle circle-2"></div>
                <div class="circle circle-3"></div>
                <div class="circle circle-4"></div>
                <div class="circle circle-5"></div>
                <i class="uk-icon-rz-file"></i>
            </div>`)
            this.attached = true
        } catch (e) {
            console.error(e)
github ComputerScienceHouse / conditional / frontend / javascript / modules / dropzone.js View on Github external
import Dropzone from "dropzone";
Dropzone.autoDiscover = false;

export default class DropzoneUpload {
  constructor(element) {
    this.element = element;
    this.render();
  }

  render() {
    const dz = new Dropzone(this.element); // eslint-disable-line new-cap
    dz.on("complete", () => window.location.reload());
  }
}

Dropzone.options.uploadUser = {
  acceptedFiles: ".csv"
};
github roadiz / roadiz / themes / Rozier / Resources / app / components / documents / DocumentUploader.js View on Github external
init () {
        const _self = this

        // Get folder id
        let form = $('#upload-dropzone-document')

        if (form.attr('data-folder-id') && form.attr('data-folder-id') > 0) {
            this.options.headers.folderId = parseInt(form.attr('data-folder-id'))
            this.options.url = window.Rozier.routes.documentsUploadPage + '/' + parseInt(form.attr('data-folder-id'))
        }

        Dropzone.options.uploadDropzoneDocument = {
            url: this.options.url,
            method: 'post',
            headers: this.options.headers,
            paramName: this.options.paramName,
            uploadMultiple: this.options.uploadMultiple,
            timeout: this.options.timeout,
            maxFilesize: this.options.maxFilesize,
            dictDefaultMessage: this.options.dictDefaultMessage,
            dictFallbackMessage: this.options.dictFallbackMessage,
            dictFallbackText: this.options.dictFallbackText,
            dictFileTooBig: this.options.dictFileTooBig,
            dictInvalidFileType: this.options.dictInvalidFileType,
            dictResponseError: this.options.dictResponseError,
            dictCancelUpload: this.options.dictCancelUpload,
            dictCancelUploadConfirmation: this.options.dictCancelUploadConfirmation,
            dictRemoveFile: this.options.dictRemoveFile,
github JBEI / edd / typescript / src / GCMS_Workbench.ts View on Github external
$("#add-molecule").click(function() {
        onAddMolecule();
    });
    $("#del-molecule").click(function() {
        onDeleteMolecule();
    });
    $("#n-molecules").data("n_mols", 1);
});

// http://stackoverflow.com/questions/22063612
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
    const token = Utl.EDD.findCSRFToken();
    jqXHR.setRequestHeader("X-CSRFToken", token);
});

Dropzone.options.gcmsDropzone = {
    "uploadMultiple": false,
    "previewsContainer": "#file-preview",
    "init": function() {
        this.element
            .querySelector("button[type=submit]")
            .addEventListener("click", (e) => {
                // Make sure that the form isn't actually being sent.
                e.preventDefault();
                e.stopPropagation();
                if (this.files.length === 0) {
                    alert("No input file specified!");
                    return false;
                }
                // reset the upload queue
                for (const file of this.files) {
                    file.status = Dropzone.QUEUED;
github enyo / dropzone / js / index.js View on Github external
var Dropzone = require("dropzone"),
    Opentip = require("opentip"),
    o = require("jquery");

Dropzone.options.demoUpload = {
  addRemoveLinks: true,
  fallback: function() {
    Dropzone.prototype.defaultOptions.fallback.call(this);
    o(this.element).append("<p>This is what the file uploads with Dropzone look like in modern browsers:<br><img alt="\&quot;preview\&quot;" src="\&quot;/images/preview.png\&quot;"></p>");
  }
};