Skip to content

Conversation

@Tanmay-008
Copy link
Contributor

@Tanmay-008 Tanmay-008 commented Oct 12, 2025

Summary

This PR introduces a dynamic file upload middleware in the Motia framework to correctly handle multipart/form-data requests.

Earlier, Motia did not process multipart requests — meaning file uploads via API routes were ignored or caused errors.

This update solves that by integrating Multer as an on-demand middleware that activates only when a request contains multipart/form-data.
It ensures that uploaded files are processed, parsed, and stored at user-defined destinations according to the fileUploadSchema configuration for each step.

Related Issues

fixes #804

Type of Change

[ ] New feature

Checklist

  • I have read the CONTRIBUTING.md
  • My code follows the code style of this project
  • I have added tests where applicable
  • I have tested my changes locally
  • I have linked relevant issues
  • I have added screenshots for UI changes (if applicable)

Screenshots (if applicable)

Additional Context

@vercel
Copy link

vercel bot commented Oct 12, 2025

Someone is attempting to deploy a commit to the motia Team on Vercel.

A member of the Team first needs to authorize it.

@rohitg00
Copy link
Contributor

Thanks for this PR, I'll let @sergiofilhowz and @ytallo take over this, but can you please ignore committing the pnpm-lock file for this? @Tanmayshi thanks

@Tanmay-008
Copy link
Contributor Author

@rohitg00 , Thanks for reviewing! Sure, I’ll avoid committing the pnpm-lock.yaml file next time. It got updated automatically because I installed multer for handling file uploads.

Copy link
Contributor

@sergiofilhowz sergiofilhowz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately as much as i like the implementation, this doesn't quite work in cloud environment, especially with AWS Lambdas where we don't have full control over the filesystem

@sergiofilhowz
Copy link
Contributor

Thanks for this PR, I'll let @sergiofilhowz and @ytallo take over this, but can you please ignore committing the pnpm-lock file for this? @Tanmayshi thanks

this one is necessary since he's adding a new dependency (multer)

@Tanmayshi let's hold this for a bit, there's another PR that addresses long data through process that we could use in this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Motia framework does not handle multipart/form-data requests.

3 participants