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
Import From URL
The @sme-uploader/url
plugin allows users to import files from the internet. Paste any URL and it will be added!
A Companion instance is required for the @sme-uploader/url
plugin to work. Companion will download the files and upload them to their destination. This saves bandwidth for the user (especially on mobile connections) and helps to avoid CORS restrictions.
const Url = require('@sme-uploader/url'); uploader.use(Url, { // Options }); |
Installation
This plugin is published as the @sme-uploader/url
package.
Install from NPM:
npm install @sme-uploader/url |
In the CDN package, it is available on the SmeUploader
global object:
const Url = SmeUploader.Url; |
CSS
The @sme-uploader/url
plugin requires the following CSS for styling:
import '@sme-uploader/core/dist/style.css'; import '@sme-uploader/url/dist/style.css'; |
Import general Core styles from @sme-uploader/core/dist/style.css
first, then add the Url styles from @sme-uploader/url/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/url
plugin has the following configurable options:
uploader.use(Url, { target: Dashboard, companionUrl: 'https://companion.uploader.io/', locale: {} }); |
id: 'Url'
A unique identifier for this plugin. It defaults to 'Url'
.
title: 'Link'
Configures the title / name shown in the UI, for instance, on Dashboard tabs. It defaults to 'Link'
.
target: null
DOM element, CSS selector, or plugin to mount the URL provider into. This should normally be the @sme-uploader/dashboard
plugin.
companionUrl: null
URL to an Companion instance.
locale: {}
Localize text that is shown to the user.
The default English strings are:
strings: { // Label for the "Import" button. import: 'Import', // Placeholder text for the URL input. enterUrlToImport: 'Enter URL to import a file', // Error message shown if Companion could not load a URL. failedToFetch: 'Companion failed to fetch this URL, please make sure it’s correct', // Error message shown if the input does not look like a URL. enterCorrectUrl: 'Incorrect URL: Please make sure you are entering a direct link to a file' } |
Methods
addFile
You can add a file to the Url plugin directly via the API, like this:
uploader.getPlugin('Url').addFile('https://example.com/myfile.pdf').then(uploader.upload); |