1
0
Fork 0
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:
Rafael França 2020-12-03 10:49:08 -05:00 committed by GitHub
commit cafdd18721
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -618,11 +618,17 @@ directly from the client to the cloud.
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
<%= 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.