title: Rails 7 view and direct upload image from browser client
body: <p>It's been a long time since I've used Rails for the frontend of a web app, and I want to use the most update version of course, but it seems a lot has changed and I don't know which is the most Rails Way to do it anymore.</p>
  <p>I've tried to use JQuery and the FileUpload plugin, but we don't have JQuery anymore, I mean I've tried to add it but it was a pain in the ass using the new import map (problem with me, I know if I look up some tutorials I can do i), but that seems to go agains the current mentality of JS in rails apps.</p>
  <p>Then I've went to checkout the new Hotwire + Stimulus but I don't even now where to start, but from the little that I saw don't know if will handle this scenario: <strong>I already have a <code>presigned_url</code> from my <code>S3 Bucket</code>, and simply have a form with a <code>f.file_field</code> which I want to upload this file from the clients browser directly to <code>S3</code> doing a <code>POST</code> request, so the user don't get blocked waiting the upload to finish</strong></p>
  <p>Correct me if I'm wrong but to trigger JS functions the Rails Way now is to use <code>Stimulus</code> with <code>HTML Data Attributes</code> but I'm not sure if I could pass the file in this data attribute.</p>
  <p>Looking other tutorials I'm starting to think that the best approach would be to have a <code>turbo_stream_tag</code> to wrap my form, and then when submitting the form will hit this turbo controller which will act as a ajax request, running asynchronously doing a post request using <code>Net:HTTP</code> or even the <code>s3</code> gem itself, I'm just not sure if I would have access to the file.</p>
  <p>Any kind soul to clarify this? Thanks and sorry for the long post.</p>