forked from tsai/eShopOnAbp
83 changed files with 2603 additions and 50163 deletions
@ -1,76 +1,98 @@ |
|||||
# Uppy |
# Uppy |
||||
|
|
||||
Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can use |
Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can |
||||
this from a CDN (e.g. `<script src="https://releases.transloadit.com/uppy/v1.31.1/uppy.min.js"></script>`) or bundle it with your webapp. |
use this from a CDN |
||||
|
(`<script src="https://releases.transloadit.com/uppy/v3.25.3/uppy.min.js"></script>`) |
||||
|
or bundle it with your webapp. |
||||
|
|
||||
Note that the recommended way to use Uppy is to install it with yarn/npm and use a |
Note that the recommended way to use Uppy is to install it with yarn/npm and use |
||||
bundler like Webpack so that you can create a smaller custom build with just the |
a bundler like Webpack so that you can create a smaller custom build with only |
||||
things that you need. More info on <https://uppy.io/docs/#With-a-module-bundler>. |
the things that you need. More info on |
||||
|
<https://uppy.io/docs/#With-a-module-bundler>. |
||||
|
|
||||
## How to use this bundle |
## How to use this bundle |
||||
|
|
||||
You can extract the contents of this zip to e.g. `./js/uppy` |
You can extract the contents of this zip to a directory, such as `./js/uppy`. |
||||
|
|
||||
Now you can create an HTML file, e.g.: `./upload.html` with the following contents: |
Now you can create an HTML file, for example `./upload.html`, with the following |
||||
|
contents: |
||||
|
|
||||
```html |
```html |
||||
<html> |
<html> |
||||
<head> |
<head> |
||||
<link rel="stylesheet" href="./js/uppy/uppy.min.css"> |
<link rel="stylesheet" href="./js/uppy/uppy.min.css" /> |
||||
</head> |
</head> |
||||
|
|
||||
<body> |
<body> |
||||
<div class="DashboardContainer"></div> |
<div class="DashboardContainer"></div> |
||||
<button class="UppyModalOpenerBtn">Upload</button> |
<button class="UppyModalOpenerBtn">Upload</button> |
||||
<div class="uploaded-files"> |
<div class="uploaded-files"> |
||||
<h5>Uploaded files:</h5> |
<h5>Uploaded files:</h5> |
||||
<ol></ol> |
<ol></ol> |
||||
</div> |
</div> |
||||
</body> |
</body> |
||||
|
|
||||
<script src="./js/uppy/uppy.min.js"></script> |
<script type="module"> |
||||
<script> |
import { Uppy, Dashboard, Tus } from './js/uppy/uppy.min.mjs' |
||||
var uppy = Uppy.Core({ |
var uppy = new Uppy({ |
||||
debug : true, |
debug: true, |
||||
autoProceed: false, |
autoProceed: false, |
||||
}) |
|
||||
.use(Uppy.Dashboard, { |
|
||||
browserBackButtonClose: false, |
|
||||
height : 470, |
|
||||
inline : false, |
|
||||
replaceTargetContent : true, |
|
||||
showProgressDetails : true, |
|
||||
target : '.DashboardContainer', |
|
||||
trigger : '.UppyModalOpenerBtn', |
|
||||
metaFields : [ |
|
||||
{ id: 'name', name: 'Name', placeholder: 'file name' }, |
|
||||
{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' } |
|
||||
] |
|
||||
}) |
}) |
||||
.use(Uppy.Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }) |
.use(Dashboard, { |
||||
.on('upload-success', function (file, response) { |
browserBackButtonClose: false, |
||||
var url = response.uploadURL |
height: 470, |
||||
var fileName = file.name |
inline: false, |
||||
|
replaceTargetContent: true, |
||||
document.querySelector('.uploaded-files ol').innerHTML += |
showProgressDetails: true, |
||||
'<li><a href="' + url + '" target="_blank">' + fileName + '</a></li>' |
target: '.DashboardContainer', |
||||
}) |
trigger: '.UppyModalOpenerBtn', |
||||
</script> |
metaFields: [ |
||||
|
{ id: 'name', name: 'Name', placeholder: 'file name' }, |
||||
|
{ |
||||
|
id: 'caption', |
||||
|
name: 'Caption', |
||||
|
placeholder: 'describe what the image is about', |
||||
|
}, |
||||
|
], |
||||
|
}) |
||||
|
.use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }) |
||||
|
.on('upload-success', function (file, response) { |
||||
|
var url = response.uploadURL |
||||
|
var fileName = file.name |
||||
|
|
||||
|
document.querySelector('.uploaded-files ol').innerHTML += |
||||
|
'<li><a href="' + url + '" target="_blank">' + fileName + '</a></li>' |
||||
|
}) |
||||
|
</script> |
||||
|
</html> |
||||
``` |
``` |
||||
|
|
||||
Now open `upload.html` in your browser, and the Uppy Dashboard will appear. |
Now open `upload.html` in your browser, and the Uppy Dashboard will appear. |
||||
|
|
||||
## Next steps |
## Next steps |
||||
|
|
||||
In the example you just built, Uppy uploads to a demo server where files will be deleted |
In the example you built, Uppy uploads to a demo server where files will be |
||||
shortly after uploading. You'll want to target your own tusd server, S3 bucket, or Nginx/Apache server. For the latter, use the Xhr plugin: <https://uppy.io/docs/xhr-upload/> which uploads using regular multipart form posts, that you'll existing Ruby or PHP backend will be able to make sense of, just as if a `<input type="file">` had been used. |
deleted shortly after uploading. You’ll want to target your own tusd server, S3 |
||||
|
bucket, or Nginx/Apache server. For the latter, use the Xhr plugin: |
||||
|
<https://uppy.io/docs/xhr-upload/> which uploads using regular multipart form |
||||
|
posts, that you’ll existing Ruby or PHP backend will be able to make sense of, |
||||
|
as if a `<input type="file">` had been used. |
||||
|
|
||||
The Dashboard currently opens when clicking the button, but you can also draw it inline into the page. This, and many more configuration options can be found here: <https://uppy.io/docs/dashboard/>. |
The Dashboard now opens when clicking the button, but you can also draw it |
||||
|
inline into the page. This, and many more configuration options can be found |
||||
|
here: <https://uppy.io/docs/dashboard/>. |
||||
|
|
||||
Uppy has many more Plugins besides Xhr and the Dashboard. For example, you can enable Webcam, Instagram, or video encoding support. For a full list of Plugins check here: <https://uppy.io/docs/plugins/>. |
Uppy has many more Plugins besides Xhr and the Dashboard. For example, you can |
||||
|
enable Webcam, Instagram, or video encoding support. For a full list of Plugins |
||||
|
check here: <https://uppy.io/docs/plugins/>. |
||||
|
|
||||
Note that for some Plugins, you will need to run a server side component called: Companion. Those plugins are marked with a (c) symbol. Alternatively, you can sign up for a free Transloadit account. Transloadit runs Companion for you, tusd servers to handle resumable file uploads, and can post-process files to scan for viruses, recognize faces, etc. Check: <https://transloadit.com>. |
Note that for some Plugins, you will need to run a server side component called: |
||||
|
Companion. Those plugins are marked with a (c) symbol. Alternatively, you can |
||||
|
sign up for a free Transloadit account. Transloadit runs Companion for you, tusd |
||||
|
servers to handle resumable file uploads, and can post-process files to scan for |
||||
|
viruses, recognize faces, etc. Check: <https://transloadit.com>. |
||||
|
|
||||
## Getting help |
## Getting help |
||||
|
|
||||
Stuck with anything? We're welcoming all your questions and feedback over at <https://community.transloadit.com/c/uppy/5>. |
Stuck with anything? We’re welcoming all your questions and feedback over at |
||||
|
<https://community.transloadit.com/c/uppy/5>. |
||||
|
|||||
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Loading…
Reference in new issue