More README fixes

parent ea0baf52
...@@ -97,20 +97,31 @@ POST /s3/multipart/:uploadId/complete ...@@ -97,20 +97,31 @@ POST /s3/multipart/:uploadId/complete
DELETE /s3/multipart/:uploadId DELETE /s3/multipart/:uploadId
``` ```
Finally, in your Uppy configuration set `serverUrl` to your app's URL or an Finally, in your Uppy configuration set `serverUrl` to your app's URL:
empty string:
```js ```js
// ... // ...
uppy.use(Uppy.AwsS3Multipart, { uppy.use(Uppy.AwsS3Multipart, {
serverUrl: '', // uses relative URLs (pass 'https://your-app.com' for absolute URLs) serverUrl: window.location.origin, // your application
})
uppy.on('upload-success', function (file, data, uploadURL) {
var uploadedFileData = JSON.stringify({
id: uploadURL.match(/\/cache\/([^\?]+)/)[1], // extract key without prefix
storage: 'cache',
metadata: {
size: file.size,
filename: file.name,
mime_type: file.type,
}
})
// ...
}) })
``` ```
**See [Adding Direct S3 Uploads] for an example of a complete Uppy setup with **See [Adding Direct S3 Uploads] for an example of a complete Uppy setup with
Shrine. From there you can just swap the `AwsS3` Uppy plugin for the Shrine. From there you can swap the `presign_endpoint` + `AwsS3` code with the
`AwsS3Multipart` plugin, and `presign_endpoint` Shrine plugin for the `uppy_s3_multipart` + `AwsS3Multipart` setup.**
`uppy_s3_multipart` plugin.**
Both the plugin and method accepts `:options` for specifying additional options Both the plugin and method accepts `:options` for specifying additional options
to the aws-sdk calls (read further for more details on these options): to the aws-sdk calls (read further for more details on these options):
...@@ -134,7 +145,8 @@ instructions on how to opt in. ...@@ -134,7 +145,8 @@ instructions on how to opt in.
### Standalone ### Standalone
You can also initialize `Uppy::S3Multipart::App` directly: You can also use `uppy-s3_multipart` without Shrine. Start by initializing the
`Uppy::S3Multipart::App` directly:
```rb ```rb
require "uppy/s3_multipart" require "uppy/s3_multipart"
...@@ -164,26 +176,12 @@ map "/s3" do ...@@ -164,26 +176,12 @@ map "/s3" do
end end
``` ```
In your Uppy configuration set `serverUrl` to your app's URL or an empty In your Uppy configuration set `serverUrl` to your app's URL:
string:
```js ```js
// ... // ...
uppy.use(Uppy.AwsS3Multipart, { uppy.use(Uppy.AwsS3Multipart, {
serverUrl: window.location.origin, // current scheme + host + port serverUrl: window.location.origin, // your application
})
uppy.on('upload-success', function (file, data, uploadURL) {
var uploadedFileData = JSON.stringify({
id: uploadURL.match(/\/cache\/([^\?]+)/)[1], // extract key without prefix
storage: 'cache',
metadata: {
size: file.size,
filename: file.name,
mime_type: file.type,
}
})
// ...
}) })
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment