The old config method was used in Next.js within the pages directory to set specific configurations for each API route. However, for Next.js 13 and later, config settings cannot be applied in this way within the app directory.
You can use for this formidable library; Please check This