Dropzone

Dropzone.js is one of the most popular drag and drop JavaScript libraries. It is free, fully open source, and makes it easy for you to handle dropped files on your website.

Basic example

Use class .dropzone

							
                                
<template>
    <BCol>
        <form ref="dropzoneForm" class="dropzone">
            <div class="fallback">
                <input name="file" type="file" multiple />
            </div>
        </form>
    </BCol>
</template>

<script>
import Dropzone from "dropzone";
import "dropzone/dist/dropzone.css";

export default {
  mounted() {
    this.initializeDropzone();
  },
  methods: {
    initializeDropzone() {
      new Dropzone(this.$refs.dropzoneForm, {
        url: "http://localhost:3000/", // Replace with your actual upload URL
        paramName: "file", // The name that will be used to transfer the file
        maxFilesize: 2, // Max file size in MB
        acceptedFiles: ".jpeg,.jpg,.png,.pdf", // Accepted file types
        addRemoveLinks: true, // Option to add a link to remove the file
      });
    },
  },
};
</script>