Skip to content

PUT Requests with multipart/form-data Fail to Include File Data #1698

Closed Answered by RobinTail
yuuri111 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @yuuri111 ,

You need to add the inputSources to your config, because the inputs aggregation from files is only configured for POST by default. So you can adjust it for your needs this way:

export const config = createConfig({
  inputSources: {
    put: ["body", "params", "files"], // <———
  },
  server: {
    listen: 3000, 
    upload: true
  },
  cors: true,
  logger: { level: "debug", color: true },
});

Details: https://github.com/RobinTail/express-zod-api#customizing-input-sources

Let me know if it worked for you.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by RobinTail
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
good first issue Good for newcomers
2 participants