Skip to content

Commit

Permalink
Updates to section about passing params per request. Also remove the …
Browse files Browse the repository at this point in the history
…irrelevant autostore option. We don't really support configuring it
  • Loading branch information
vipulnsward committed Mar 31, 2024
1 parent 43c404a commit 87d0a04
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Using Uploadcare is simple, and here are the basics of handling files.
```ruby
@file_to_upload = File.open("your-file.png")

@uc_file = Uploadcare::Uploader.upload(@file_to_upload, store: 'auto')
@uc_file = Uploadcare::Uploader.upload(@file_to_upload, store: "auto")

@uc_file.uuid
# => "dc99200d-9bd6-4b43-bfa9-aa7bfaefca40"
Expand All @@ -108,7 +108,7 @@ Using Uploadcare is simple, and here are the basics of handling files.
The `store` option can have these possible values:
- `true`: mark the uploaded file as stored.
- `false`: do not mark the uploaded file as stored and remove it after 24 hours.
- 'auto': defers the choice of storage behavior to the [auto-store setting](https://app.uploadcare.com/projects/-/settings/#storage) for your Uploadcare project. This is the default behavior.
- `"auto"`: defers the choice of storage behavior to the [auto-store setting](https://app.uploadcare.com/projects/-/settings/#storage) for your Uploadcare project. This is the default behavior.

Your might then want to store or delete the uploaded file.

Expand All @@ -130,7 +130,7 @@ Uploadcare supports multiple ways to upload files:
# Smart upload - detects type of passed object and picks appropriate upload method
# If you have a large file (more than 100Mb / 10485760 bytes), the uploader will automatically process it with a multipart upload

Uploadcare::Uploader.upload("https://placekitten.com/96/139", store: 'auto')
Uploadcare::Uploader.upload("https://placekitten.com/96/139", store: "auto")
```

There are explicit ways to select upload type:
Expand All @@ -139,7 +139,7 @@ There are explicit ways to select upload type:
files = [File.open("1.jpg"), File.open("1.jpg")]
Uploadcare::Uploader.upload_files(files, store: 'auto')

Uploadcare::Uploader.upload_from_url("https://placekitten.com/96/139", store: 'auto')
Uploadcare::Uploader.upload_from_url("https://placekitten.com/96/139", store: "auto")
```
It is possible to track progress of the upload-from-URL process. To do that, you should specify the `async` option and get a token:

Expand Down Expand Up @@ -190,11 +190,12 @@ Options available in a block:

#### Uploading options

You can override global [`:autostore`](#initialization) option for each upload request:
You can override [auto-store setting](https://app.uploadcare.com/projects/-/settings/#storage) from your Uploadcare project for each upload request:

```ruby
@api.upload(files, store: true)
@api.upload_from_url(url, store: :auto)
@api.upload(files, store: true) # mark the uploaded file as stored.
@api.upload(files, store: false) # do not mark the uploaded file as stored and remove it after 24 hours.
@api.upload_from_url(url, store: "auto") # defers the choice of storage behavior to the auto-store setting.
```

You can upload file with custom metadata, for example `subsystem` and `pet`:
Expand Down

0 comments on commit 87d0a04

Please sign in to comment.