Drag & Drop Upload

Drag & Drop Upload

alord84alord84 Posts: 24Questions: 15Answers: 1

Following this: https://editor.datatables.net/plug-ins/field-type/editor.upload

The user may drop more than one photo in the drag n drop field creating multiple records of the same file in the database and server.
1. How would I allow only one file.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin
    Answer ✓

    Hi,

    What you would need to do is immediately before the dataTransfer.file array is accessed (e.originalEvent.dataTransfer.files[0]), do a check on the length. If it is > 1, then show an error - otherwise just have the code carry on!

    Allan

This discussion has been closed.