File upload to customer controller stopped working in 4.20.4?

File uploading to a custom controller worked in 4.15.0 but since upgrading to 4.20.4 we have noticed file uploads to our custom controllers have stopped working.

Anyone have the same issue or any ideas?

This topic has been created from a Discord post (1217037641556426833) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

File upload to custom controller stopped working in 4.20.4?

This is a blocker in our busines atm

You probably want to share your controllers code

Other then that you can look for commits on upload…

I think the resent change was size in bytes

Just a guess that it might actually affect custom controller code

But that pull is only for tests it seems you need to find earlier one

thanks, i went through all the releases and commits to try track something down but could not find anything obvious. I saw the ‘sizeInBytes’ change but doubt that would break anything.

I have more info on the issue I have raised:

Controller code:

export default factories.createCoreController('api::media.media', ({ strapi }) => ({
  async create(ctx) {
    const files = ctx.request.files // <- this is now empty {}
    const filess = ctx.request.body.files // <- this is '[object Object]'

    return strapi.service('api::media.media').create({files});
  }
}))

Its turns out this was an issue from our frontend :confused: . How embarassing. This is not an issue with strapi. This has been solved.

Thanks for your input!