JavaScript Vanilla Library To Create A Drop Zone For Input File Element | DnD Zone

DnD Zone is a JavaScript library that converts a file input into a file drop zone where you can specify the files to upload by drag and drop.

If you are looking for a simple script that contains a drop area for the input file for your form, the DnD area can help. Other than that, use libraries like DropzoneJS and jQuery File Upload. DnD region is 2.5 kb gzip and no dependencies. It will only work on modern browsers.

How to make use of it:

1. Download the JavaScript library for the DnD region on the page.

<script src="dnd-zone.js"></script>

2. Enter the input file in the drop area.

<div class="dndzone" id="dndzone-example">
  <div class="dndzone-area">
     Drop files or Click here to select files. 
  <input type="file" class="dndzone-input" />

3. Create a DnD zone and you’re done.

new DnDZone(document.getElementById('dndzone-example'));

4. Apply your own patterns to the projection area.

.dndzone-area {
  /* styles here */

5. Defines the file types that the file entry must accept.

<input type="file" accept="image/*" class="dndzone-input" />
// or
new DnDZone(document.getElementById('dndzone-example'),{
    accept: 'image/*'

6. Decide whether to trigger the change event when files are dropped or selected.

new DnDZone(document.getElementById('dndzone-example'),{
    triggerChange: true

7. Trigger functions before/after dropping or selecting files.

new DnDZone(document.getElementById('dndzone-example'),{
    afterFilesAdded: function(files){
    beforeFilesAdded: function(files){

File Drop Zone For Uploader, DnD Zone Plugin/Github

See Demo And Download

Official Website(zahedkamal87): Click Here

This superior jQuery/javascript plugin is developed by zahedkamal87. For extra Advanced Usages, please go to the official website.

Related Posts


[Icon Picker] Iconpicker for Bootstrap 5 Icons Library

Bootstrap 5-based icon picker which supports any icon libraries like Bootstrap Icons, Font Awesome[], etc. Must Read: 1000+ Pixel Perfect SVG Icons For Vue Components | Unicons How…


Bootstrap Multiple Image Upload with Preview and Delete | ImagesLoader

ImagesLoader is a standard bootstrap image upload plugin that provides an easy-to-use and nice-looking interface for uploading multiple images to a web server. Must Read: HTML 5…


A Lightweight jQuery Plugin for Animating Split-Flap Displays | fallblatt

fallblatt is a lightweight jQuery plugin for animating split screens. This jQuery plugin allows you to include such offers in your web application. Everything from virtual departure…


Dark & Light Switch Mode Toggle for Bootstrap 5

Switching to dark mode is done by toggling HTML tags that include -dark or -light as a category. It is made by manipulating the DOM with JavaScript. The text color also changes depending…


jQuery Plugin for Countdown Timer on HTML Page | SyoTimer

yoTimer jQuery plugin allows you to create digital style countdowns/periodic timers on the webpage, with callbacks support and timezone/translation customization. Features Periodic count with the specified period…


Dynamic, Data-driven Periodic Table built with Vue.js

Periodicity is a dynamic, data-driven periodic table created with Vue.js that uses D3 animations and graphs to show the beauty of periodic trends. Built With vue.js (component…