Skip to content

Examples and guides for using the OpenAI API

Fix File Q&A build error due to removed way of assigning options to the Formidable instance (#372)

Matthew Jericho Go Syb7d3f3519eea
diff --git a/apps/file-q-and-a/nextjs/src/pages/api/process-file.ts b/apps/file-q-and-a/nextjs/src/pages/api/process-file.ts
index 2d874d52..2b0d2280 100644
--- a/apps/file-q-and-a/nextjs/src/pages/api/process-file.ts
+++ b/apps/file-q-and-a/nextjs/src/pages/api/process-file.ts
@@ -26,8 +26,10 @@ export default async function handler(
}
// Create a formidable instance to parse the request as a multipart form
- const form = new formidable.IncomingForm();
- form.maxFileSize = 30 * 1024 * 1024; // Set the max file size to 30MB
+ const options = {
+ maxFileSize: 30 * 1024 * 1024 // Set the max file size to 30MB
+ };
+ const form = formidable(options);
try {
const { fields, files } = await new Promise<{