Witam,
Po przeczytaniu  tego artykułu staram się połączyć dnd z input multiple.
Działa poprawnie jeśli użyje input i wybiore kilka zdjęć wyświtlą mi się oraz tablica file[] jest wypełniona.
Jednak jeśli użyje drag n drop zdjęcia mi się wyświetlą w <output> jednak nic nie dostaje się do input file[] jak zrobić żeby automatycznie też wypełniała się tablica w input ?
Będę wdzięczny za pomoc :)
Pozdrawiam

kod:

<output id="list"></output>
<div id="drop_zone">Przeciągnij i upuść zdjęcia tutaj</div>

<%= file_field_tag "file", :multiple => true, :name => "file[]" %>
<script>
  function handleFileSelect(evt) {
    evt.stopPropagation();
    evt.preventDefault();

    var files = evt.target.files || evt.dataTransfer.files; // FileList object

    // Loop through the FileList and render image files as thumbnails.
    for (var i = 0, f; f = files[i]; i++) {

      // Only process image files.
      if (!f.type.match('image.*')) {
        continue;
      }

      var reader = new FileReader();

      // Closure to capture the file information.
      reader.onload = (function(theFile) {
        return function(e) {
          // Render thumbnail.
          var span = document.createElement('span');
          span.innerHTML = ['<img class="thumb" src="', e.target.result,
                            '" title="', escape(theFile.name), '"/>'].join('');
          document.getElementById('list').insertBefore(span, null);
        };
      })(f);

      // Read in the image file as a data URL.
      reader.readAsDataURL(f);
    }
  }

  function handleDragOver(evt) {
    evt.stopPropagation();
    evt.preventDefault();
    evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
  }

    // Setup the dnd listeners.
  var dropZone = document.getElementById('drop_zone');
  dropZone.addEventListener('dragover', handleDragOver, false);
  dropZone.addEventListener('drop', handleFileSelect, false);

  document.getElementById('file').addEventListener('change', handleFileSelect, false);
</script>