Conversation
def active_storage_meta_tags | ||
safe_join [ | ||
tag.meta(name: 'direct-uploads-url', content: rails_direct_uploads_url) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's only one tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'm thinking that maybe we should just decorate the specific file input tag with the URL instead. Like we do with other data-url decorations. We'll wrap that into a direct_upload_file_tag anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, yes. Leaves us open to adding more without introducing a name change like csrf_meta_tags
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's supported currently and will take precedence over the the meta tag value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the meta tag is just there to save repeating the URL on the input tags? That seems like a bit of an over-optimization to me. I'd rather just have it on the input tag alone, such that using this feature doesn't require any setup gymnastics.
Demo / example using these direct upload events: https://gist.github.com/javan/5538692cb37a683db15792be8d05761e |
@javan looks great! Is there a way to start the upload as soon as the user selects the file(s) rather than when the form is submitted? |
@isaac not currently, but you can implement that yourself by handling a file input's |
Fixes #29
Probably fixes #79
Closes #35