[Answered ]-How to make html drag and drop only accept videos

1👍

in your javascript use

replace ‘file’ with .mp4 or what ever file type you use

if (item.kind === 'file') {
        const file = item.getAsFile();
        console.log(`… file[${i}].name = ${file.name}`);
      }
    });
  } else {
    // Use DataTransfer interface to access the file(s)
    [...ev.dataTransfer.files].forEach((file, i) => {
      console.log(`… file[${i}].name = ${file.name}`);
    });
  }
}

Leave a comment