mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #40731 from ghiculescu/patch-2
ActiveStorage Direct Upload docs improvements [ci skip]
This commit is contained in:
commit
cafdd18721
1 changed files with 7 additions and 1 deletions
|
@ -618,12 +618,18 @@ directly from the client to the cloud.
|
||||||
ActiveStorage.start()
|
ActiveStorage.start()
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Annotate file inputs with the direct upload URL.
|
2. Add `direct_upload: true` to your [`file_field`](form_helpers.html#uploading-files).
|
||||||
|
|
||||||
```erb
|
```erb
|
||||||
<%= form.file_field :attachments, multiple: true, direct_upload: true %>
|
<%= form.file_field :attachments, multiple: true, direct_upload: true %>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you aren't using a [FormBuilder](form_helpers.html#customizing-form-builders), add the data attribute directly:
|
||||||
|
|
||||||
|
```erb
|
||||||
|
<input type=file data-direct-upload-url="<%= rails_direct_uploads_url %>" />
|
||||||
|
```
|
||||||
|
|
||||||
3. Configure CORS on third-party storage services to allow direct upload requests.
|
3. Configure CORS on third-party storage services to allow direct upload requests.
|
||||||
|
|
||||||
4. That's it! Uploads begin upon form submission.
|
4. That's it! Uploads begin upon form submission.
|
||||||
|
|
Loading…
Reference in a new issue