Vue File upload

Vue Bootstrap 5 File upload plugin

MD Bootstrap's File Upload plugin is an extension that allows you to upload files by using drag and drop functionality. Easy to use, setup and customize.

File upload plugin built with the latest Bootstrap 5. Many customization options like custom height, max size, confirmation message, and much more.

Note: Read the API tab to find all available options and advanced customization


Basic example


Default message example

By adding defaultMsg prop you can set main message of the file upload.


Custom height example

By adding height prop you can set its custom height.


Max size

By adding maxFileSize prop you can set max size of a file.


Default value

By adding defaultFiles prop you can set default files array in the file upload element.


Disable

By adding disabled prop you can disable the component.


Accept formats

By adding accept prop you can set allowed file types.


Disabled remove button

By adding disabledRemoveBtn prop you can remove "Remove button".


Multiple files

By adding multiple prop you can allow to upload more than single file.


Multiple with files limit

By adding maxFilesQuantity prop you can set limit of uploaded files.

Vue File upload - API


Import


        import { MDBFileUpload } from "mdb-vue-file-upload";
      

Properties

Name Type Default Description
accept String '*' Allows you to set specific file formats
defaultFiles Array [] Allows you set default files
defaultMsg String 'Drag and drop a file here or click' Changes text of default message
disabled Boolean false Makes drag and drop disabled
disabledRemoveBtn Boolean false Allows you to disabled remove button
height Number Changes height of dropzone
mainError String 'Ooops, something wrong happended.' Changes text of main error message
maxFilesQuantity Number Infinity Allows you to upload specific number of files
maxFileSize Number Changes allowed file max size
maxSizeError String 'Your file is too big (Max size ~~~)' Changes text of size's error (add '~~~' to show value of max size)
multiple Boolean false Allows you to upload more than single file
previewMsg String 'Drag and drop or click to replace' Changes text of file's preview
removeBtn String 'Remove' Changes text of remove button

Methods

Name Description
clear Clears an input and file list

Events

Name Description
change This event fires immediately after any change. It returns a file list.
clear This event fires immediately after file upload plugin was cleared.
error This event fires immediately when you upload a file with a wrong size.
remove This event fires immediately when a file has been remove from file upload component. It returns a file list.

For example, to listen on file change add an event


        <MDBFileUpload @change="handleChange" />