README tweaks

parent 3425d340
...@@ -264,32 +264,34 @@ parameters. The parameters can be provided statically: ...@@ -264,32 +264,34 @@ parameters. The parameters can be provided statically:
```rb ```rb
options: { options: {
create_multipart_upload: { cache_control: "max-age=#{365*24*60*60}" }, create_multipart_upload: { cache_control: "max-age=#{365*24*60*60}" },
prepare_upload_part: { expires_in: 10 },
} }
``` ```
or generated dynamically for each request: or generated dynamically for each request, in which case a [`Rack::Request`]
object is also passed to the block:
```rb ```rb
options: { options: {
create_multipart_upload: -> (request) do create_multipart_upload: -> (request) {
{ key: SecureRandom.uuid } { key: SecureRandom.uuid }
end }
} }
``` ```
In that case a [`Rack::Request`] object is also passed to the block. The The initial request to `POST /s3/multipart` (which calls the
initial request to `POST /s3/multipart` will contain `type` and `filename` `#create_multipart_upload` operation) will contain `type` and `filename` query
query parameters, so for example you could use that to make requesting the URL parameters, so for example you could use that to make requesting the URL later
later force a download with the original filename (using the force a download with the original filename (using the [content_disposition]
[content_disposition] gem): gem):
```rb ```rb
options: { options: {
create_multipart_upload: -> (request) do create_multipart_upload: -> (request) {
filename = request.params["filename"] filename = request.params["filename"]
{ content_disposition: ContentDisposition.attachment(filename) } { content_disposition: ContentDisposition.attachment(filename) }
end }
} }
``` ```
...@@ -335,7 +337,7 @@ require "uppy/s3_multipart/client" ...@@ -335,7 +337,7 @@ require "uppy/s3_multipart/client"
client = Uppy::S3Multipart::Client.new(bucket: bucket) client = Uppy::S3Multipart::Client.new(bucket: bucket)
``` ```
#### `create_multipart_upload` #### `#create_multipart_upload`
Initiates a new multipart upload. Initiates a new multipart upload.
......
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