现代化的上传组件。 https://uppy.io/
|
7 vuotta sitten | |
---|---|---|
assets | 7 vuotta sitten | |
bin | 7 vuotta sitten | |
examples | 7 vuotta sitten | |
src | 7 vuotta sitten | |
test | 7 vuotta sitten | |
website | 7 vuotta sitten | |
.babelrc | 7 vuotta sitten | |
.browsersync.js | 9 vuotta sitten | |
.editorconfig | 9 vuotta sitten | |
.eslintignore | 7 vuotta sitten | |
.eslintrc | 7 vuotta sitten | |
.gitignore | 7 vuotta sitten | |
.travis.yml | 7 vuotta sitten | |
CHANGELOG.md | 7 vuotta sitten | |
CONTRIBUTING.md | 9 vuotta sitten | |
LICENSE | 9 vuotta sitten | |
Makefile | 8 vuotta sitten | |
README.md | 7 vuotta sitten | |
env.example.sh | 9 vuotta sitten | |
package-lock.json | 7 vuotta sitten | |
package.json | 7 vuotta sitten | |
uppy-screenshot.jpg | 7 vuotta sitten | |
uppy.code-workspace | 7 vuotta sitten |
Uppy is a sleek, modular file uploader that integrates seemlessly with any application. It’s fast, easy to use and lets you worry about more important problems than building a file uploader.
Uppy is being developed by the Transloadit team.
Code used in the above example:
const Uppy = require('uppy/lib/core')
const Dashboard = require('uppy/lib/plugins/Dashboard')
const GoogleDrive = require('uppy/lib/plugins/GoogleDrive')
const Instagram = require('uppy/lib/plugins/Instagram')
const Webcam = require('uppy/lib/plugins/Webcam')
const Tus = require('uppy/lib/plugins/Tus')
const uppy = Uppy({ autoProceed: false })
.use(Dashboard, { trigger: '#select-files' })
.use(GoogleDrive, { target: Dashboard, host: 'https://server.uppy.io' })
.use(Instagram, { target: Dashboard, host: 'https://server.uppy.io' })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })
.run()
.on('complete', (result) => {
console.log('Upload result:', result)
})
Try it online or read the docs for more details on how to use Uppy and its plugins.
$ npm install uppy --save
We recommend installing from NPM and then using a module bundler such as Webpack, Browserify or Rollup.js.
Add CSS uppy.min.css, either to <head>
of your HTML page or include in JS, if your bundler of choice supports it — transforms and plugins are available for Browserify and Webpack.
If you like, you can also use a pre-built bundle, for example from unpkg CDN. In that case Uppy
will attach itself to the global window.Uppy
object.
⚠️ The bundle currently consists of most Uppy plugins, so this method is not recommended for production, as your users will have to download all plugins, when you are likely using just a few.
1. Add a script to the bottom of <body>
:
<script src="https://unpkg.com/uppy"></script>
2. Add CSS to <head>
:
<link href="https://unpkg.com/uppy/dist/uppy.min.css" rel="stylesheet">
3. Initialize:
<script>
var uppy = Uppy.Core()
uppy.use(Uppy.DragDrop, { target: '.UppyDragDrop' })
uppy.use(Uppy.Tus, { endpoint: '//master.tus.io/files/' })
uppy.run()
</script>
Tus
— resumable uploads via tus.io open standardXHRUpload
— regular uploads for any backend out thereTransloadit
— support for Transloadit’s robust file encoding and processing backendDashboard
— universal UI with previews, progress bars, metadata editor and all the cool stuffDragDrop
— plain and simple drag and drop areaFileInput
— even more plain “select files” buttonProgressBar
— minimal progress bar that fills itself when upload progressesStatusBar
— more detailed progress, pause/resume/cancel buttons, percentage, speed, uploaded/total sizes (included by default with Dashboard
)Informer
— send notifications like “smile” before taking a selfie or “upload failed” when all is lost (also included by default with Dashboard
)GoldenRetriever
— restores files after a browser crash, like it’s nothingForm
— collects metadata from <form>
right before Uppy upload, then optionally appends results back to the formReduxDevTools
— for your emerging time traveling needsGoogleDrive
— select files from Google DriveDropbox
— select files from DropboxInstagram
— you guessed right — select files from InstagramWebcam
— snap and record those selfies 📷We aim to support IE10+ and recent versions of Safari, Edge, Chrome, Firefox and Opera.
Yep, we have Uppy React components, please see Uppy React docs.
Yes, whatever you want on the backend will work with XHRUpload
plugin, since it just does a POST
or PUT
request. If you want resumability with the Tus plugin, use one of tus server implementations 👌🏼
No, as mentioned previously, XHRUpload
plugin is old-school and just works with everything. However, you need uppy-server
if you’d like your users to be able to pick files from Google Drive or Dropbox (more services coming). And you can add tus if you want resumability.
Yes, there is an S3 plugin, check out the docs for more!
website/src/docs/contributing.md
CHANGELOG.md