Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (37 sloc) 1.85 KB

Dropzone Drag-n-Drop File Uploader

Web Component for Servoy NG Client

Website of component library:
https://www.dropzonejs.com/

Component properties:

  • file: binding to form variable of type MEDIA
  • option: configuration options (see dropzonejs "configuration" section) Events:
  • onDataChange: Servoy callback function to receive uploaded files
  • onFileRemove: called with file name parameter on "Remove file" click

set options using: elements..options = {option:value}

  • note: options of type function are not supported in current ver.

Example use in Servoy Form:

// Create a MEDIA var, bind it to "file" property of Dropzone
var m = solutionModel.newGlobalVariable('globals', 'gMedia', JSVariable.MEDIA);

// Create string var with same name as MEDIA var + _filename
// and _mimetype to store file info
var m_filename = '';
var m_mimetype = '';

// create a callback function and bind it to onDataChange event of Dropzone
function cbk(a, b, c){
    // a - old value, b - new value, c - event
    application.output(m) // 
    application.output(m_filename)
    application.output(m_mimetype)
    application.output(plugins.file.writeFile(plugins.file.createFile('<file path>'), b))
    m = null // clears media variable from memory, enables repeat upload of same file
}

License

All source code in the repository is licensed under a dual license. To use these components and services in your commercial or corporate internal projects, please contact sales@itechpros.com for licensing costs and information.

© iTech Professionals, Inc. http://itechpros.com

You can’t perform that action at this time.