XHR/Axios Progress with Server Actions
Hello,
I'm looking into a way to use the NextJS 15 Server Actions to upload files to an S3 bucket (which I have implemented and is working); however I am now trying to get the progress of the file upload and use that in a progress bar.
I have tried looking into XHR and Axios but have only been able to find the solution for API routes and not Server Actions.
My Current Code:
I'm looking into a way to use the NextJS 15 Server Actions to upload files to an S3 bucket (which I have implemented and is working); however I am now trying to get the progress of the file upload and use that in a progress bar.
I have tried looking into XHR and Axios but have only been able to find the solution for API routes and not Server Actions.
My Current Code:
Solution
I have figured a possible solution? However, I'm unsure if it makes sense to do so or just seems redundant?
But I have created an API route to effectively collect the data; then send it to a controller to separate the
This does seem to be working.
The API route looks something like this:
The controller looks something like this:
I then reconfigured my server action to take in the
But I have created an API route to effectively collect the data; then send it to a controller to separate the
formData and create different variables for the files and the payload; then I pass that controller data down to the server action.This does seem to be working.
The API route looks something like this:
The controller looks something like this:
I then reconfigured my server action to take in the
Files: File[] instead of the formData: FormData, along with some other general changes.