Stephane PAQUET PRO said 5 months ago on Direct Upload Instantly :
Update. [not sure if this was introduced in Rails 7 or before]
Instead of hardcoding the URL in the postURL method, it is possible to use the direct_upload: true in the file field and retrieve its value calling this.inputTarget.dataset.directUploadUrl