File Input - GET instead of POST?

Hello all,

I have a form with a file input in it. All the inputs will be a POST to my server action like normal. Except there is one caveat. I need the file input to upload its file to a different table before submitting the form. The reason being is that I need to process the file and return data to be POSTed with the rest of the form inputs.

The value in the file input being updated triggers the server action without submitting the form (this part works). The problem is I cannot figure out how to use the file input as a GET into the server connect module.

Basically, everything is working, except it is not sending the actual file to my server action.

I don’t know if it’s possible for you, but I would split it into 2 SC forms that POST the data. GET has restrictions on the length you can send so you may run into problems if your files could be larger than ~2MB

SC forms can work pretty much exactly like SC components returning data and have the same dynamic events but accept as POST so you can follow the same process as you were planning without the limitations of GET.

You might also consider sending the file, process it, save it to the server (or an S3 bucket), return the data required for your final step but not the file itself. When the user finishes that step and submits, the file is retrieved from your server/S3 rather than having to upload it again.

1 Like

Thank you for the insight. I am going to reconfigure my form to be more like you described.