Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

FileDrop

Davit Barbakadze edited this page · 6 revisions

Table of Contents

Constructor

FileDrop(options)

Turn arbitrary DOM element to a drop zone accepting files. Converts selected files to File objects, to be used in conjunction with Image, preloaded in memory with FileReader or uploaded to a server through XMLHttpRequest.

Arguments

  • options Object|String
    If options has typeof string, argument is considered as options.drop_zone
    • drop_zone String|DOMElement
      DOM Element to turn into a drop zone
    • [accept] Array
      Array of mime types to accept. By default accepts all
    • [required_caps] Object|String
      Set of required capabilities, that chosen runtime must support

Example

    <div id="drop_zone">
        Drop files here
    </div>
    <br />
    <div id="filelist"></div>

    <script type="text/javascript">
        var fileDrop = new mOxie.FileDrop('drop_zone'), fileList = mOxie.get('filelist');

        fileDrop.ondrop = function() {
            mOxie.each(this.files, function(file) {
                fileList.innerHTML += '<div>' + file.name + '</div>';
            });
        };

        fileDrop.init();
    </script>

Events

ready

Dispatched when runtime is connected and drop zone is ready to accept files.

dragenter

Dispatched when dragging cursor enters the drop zone.

dragleave

Dispatched when dragging cursor leaves the drop zone.

drop

Dispatched when file is dropped onto the drop zone.

error

Dispatched if error occurs.

Something went wrong with that request. Please try again.