Skip to content

FileDrop

Davit Barbakadze edited this page Jul 7, 2015 · 8 revisions

Important! This page is auto-generated from the comments in the source files. All changes will be overwritten! If you are looking to contribute, modify the comment in the corresponding source file instead.

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.

Arguments

  • event Object

dragenter

Dispatched when dragging cursor enters the drop zone.

Arguments

  • event Object

dragleave

Dispatched when dragging cursor leaves the drop zone.

Arguments

  • event Object

drop

Dispatched when file is dropped onto the drop zone.

Arguments

  • event Object

error

Dispatched if error occurs.

Arguments

  • event Object
Something went wrong with that request. Please try again.