Docs
- Getting Started
- SME Uploader
- Companion
- List of Plugins
- Common Plugin Options
- Custom Stores
- Locale Packs
UI Elements
Sources
- Drag & Drop
- File Input
- Webcam
- Provider Plugins
- ⓒ Dropbox
- ⓒ Google Drive
- ⓒ OneDrive
- ⓒ Zoom
- ⓒ Import From URL
Destinations
File Processing
- Image Editor
- Robodog Introduction
- Robodog File Picker
- Robodog Form
- Robodog Upload
- Robodog Dashboard
- Transloadit
Miscellaneous
Contributing
Drag & Drop
The @sme-uploader/drag-drop
plugin renders a simple drag and drop area for file selection. it can be useful when you only want the local device as a file source, don’t need file previews and a UI for metadata editing, and the Dashboard feels like overkill.
const DragDrop = require('@sme-uploader/drag-drop'); uploader.use(DragDrop, { // Options }); |
Installation
This plugin is published as the @sme-uploader/drag-drop
package.
Install from NPM:
npm install @sme-uploader/drag-drop |
In the CDN package, it is available on the SmeUploader
global object:
const DragDrop = SmeUploader.DragDrop; |
CSS
The @sme-uploader/drag-drop
plugin includes some simple styles, like shown in the example. You can also choose not to use it and provide your own styles instead.
import '@sme-uploader/core/dist/style.css'; import '@sme-uploader/drag-drop/dist/style.css'; |
Import general Core styles from @sme-uploader/core/dist/style.css
first, then add the Drag & Drop styles from @sme-uploader/drag-drop/dist/style.css
. A minified version is also available as style.min.css
at the same path. The way to do import depends on your build system.
Options
The @sme-uploader/drag-drop
plugin has the following configurable options:
uploader.use(DragDrop, { target: null, width: '100%', height: '100%', note: null, locale: {} }); |
Note that certain restrictions set in SME Uploader’s main options, namely
maxNumberOfFiles
andallowedFileTypes
, affect the system file picker dialog. IfmaxNumberOfFiles: 1
, users will only be able to select one file, andallowedFileTypes: ['video/*', '.gif']
means only videos or gifs (files with.gif
extension) will be selectable.
id: 'DragDrop'
A unique identifier for this plugin. It defaults to 'DragDrop'
. Use this if you need to add multiple DragDrop instances.
target: null
DOM element, CSS selector, or plugin to place the drag and drop area into.
width: '100%'
Drag and drop area width, set in inline CSS, so feel free to use percentage, pixels or other values that you like.
height: '100%'
Drag and drop area height, set in inline CSS, so feel free to use percentage, pixels or other values that you like.
note: null
Optionally, specify a string of text that explains something about the upload for the user. This is a place to explain any restrictions
that are put in place. For example: 'Images and video only, 2–3 files, up to 1 MB'
.
locale: {}
Localize text that is shown to the user.
The default English strings are:
strings: { // Text to show on the droppable area. // `%{browse}` is replaced with a link that opens the system file selection dialog. dropHereOr: 'Drop here or %{browse}', // Used as the label for the link that opens the system file selection dialog. browse: 'browse' } |