Skip to content

Commit be2ecdf

Browse files
Merge pull request rails#51893 from indigotechtutorials/main
Fix the Direct Upload class example in Active Storage Docs [ci skip]
2 parents b284f8b + 3855416 commit be2ecdf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

guides/source/active_storage_overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,10 +1302,10 @@ import { DirectUpload } from "@rails/activestorage"
13021302

13031303
class Uploader {
13041304
constructor(file, url) {
1305-
this.upload = new DirectUpload(this.file, this.url, this)
1305+
this.upload = new DirectUpload(file, url, this)
13061306
}
13071307

1308-
upload(file) {
1308+
uploadFile(file) {
13091309
this.upload.create((error, blob) => {
13101310
if (error) {
13111311
// Handle the error
@@ -1342,10 +1342,10 @@ class Uploader {
13421342
const headers = { 'Authentication': `Bearer ${token}` }
13431343
// INFO: Sending headers is an optional parameter. If you choose not to send headers,
13441344
// authentication will be performed using cookies or session data.
1345-
this.upload = new DirectUpload(this.file, this.url, this, headers)
1345+
this.upload = new DirectUpload(file, url, this, headers)
13461346
}
13471347

1348-
upload(file) {
1348+
uploadFile(file) {
13491349
this.upload.create((error, blob) => {
13501350
if (error) {
13511351
// Handle the error

0 commit comments

Comments
 (0)