Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

HardDrive's avatar

Passing FormData to API endpoint from external page with multiple file uploads.

I am in the process of making an API endpoint that receives data from an external React/NextJS landing page. I have Sanctum authentication setup and have done this before using just text based inputs. On this project I also need to receive multiple files so I can upload them to S3 or similar. I am ok with the S3 bit once I have received the request in a useable format.

I have been trying to pass the request from the frontend to my backend using multipart/form-data without success.

Has anyone done something similar, what approach would you use? If possible I would like to make a single api call with the files and form data. Another approach I thought was use some kind of browser session id to add one image at a time.

Any help with this appreciated

0 likes
3 replies
HardDrive's avatar

Thanks sorry that was just a typo on the post.

Please or to participate in this conversation.