Sha256: 1444f2cfd0e1eff4ee3c745b104491b7882f04f27ec858bd3476a40c6e5c3661

Contents?: true

Size: 1.39 KB

Versions: 65

Compression:

Stored size: 1.39 KB

Contents

<h3>Upload files</h3>

<div id="drop-zone">Drop files here</div>

<input id="file-input" type="file" accept="image/*">

<output id="file-list"></output>

<script type="text/javascript">
  function handleFileSelect(evt) {
    evt.stopPropagation();
    evt.preventDefault();

    var files = evt.dataTransfer.files;
		console.dir(files);

    var output = [];
		for (var i = 0, f; f = files[i]; i++) {
      output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',
          f.size, ' bytes, last modified: ',
          f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
          '</li>');
    }
    document.getElementById('file-list').innerHTML = '<ul>' + output.join('') + '</ul>';
  }

	function handleDefaults(e) {
    e.stopPropagation();
    e.preventDefault();
	}

  function handleDragOver(e) {
		handleDefaults(e);
    evt.dataTransfer.dropEffect = 'copy';
  }

	function handleDragLeave(e) {
		handleDefaults(e);
	  this.style.borderColor = '#777';
	}

	function handleDragEnter(e) {
		handleDefaults(e);
	  this.style.borderColor = '#008752';
	}

  var dropZone = document.getElementById('drop-zone');
  dropZone.addEventListener('dragover', handleDragOver, false);
  dropZone.addEventListener('drop', handleFileSelect, false);
  dropZone.addEventListener('dragleave', handleDragLeave, false);
  dropZone.addEventListener('dragenter', handleDragEnter, false);
</script>

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
dta_rapid-1.6.2 _includes/forms/dropzone.html
dta_rapid-1.6.1 _includes/forms/dropzone.html
dta_rapid-1.6.0 _includes/forms/dropzone.html
dta_rapid-1.5.12 _includes/forms/dropzone.html
dta_rapid-1.4.12 _includes/forms/dropzone.html
dta_rapid-1.4.11 _includes/forms/dropzone.html
dta_rapid-1.4.10 _includes/forms/dropzone.html
dta_rapid-1.4.9 _includes/forms/dropzone.html
dta_rapid-1.4.8 _includes/forms/dropzone.html
dta_rapid-1.4.7 _includes/forms/dropzone.html
dta_rapid-1.4.6 _includes/forms/dropzone.html
dta_rapid-1.4.5 _includes/forms/dropzone.html
dta_rapid-1.4.4 _includes/forms/dropzone.html
dta_rapid-1.4.3 _includes/forms/dropzone.html
dta_rapid-1.4.2 _includes/forms/dropzone.html
dta_rapid-1.4.1 _includes/forms/dropzone.html
dta_rapid-1.4.0 _includes/forms/dropzone.html
dta_rapid-1.3.11 _includes/forms/dropzone.html
dta_rapid-1.3.10 _includes/forms/dropzone.html
dta_rapid-1.3.9 _includes/forms/dropzone.html