You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which support plan is this issue covered by? (Community, Sponsor, Enterprise): Community
Currently blocking your project/work? (yes/no): No
Affecting a production system? (yes/no): No
Context
Node.js version: 20.17.0
Release Line of Formidable (Legacy, Current, Next): Next
Formidable exact version: 3.5.1
Environment (node, browser, native, OS): Linux Mint & Firefox
Used with (popular names of modules): None
What are you trying to achieve or the steps to reproduce?
When I submit the form twice, three times, etc. I get duplicated form field data. Here is the console output of the form data after every submissions.
Also all the field values are always an array, even if the input field for that value is a text input field? Not sure if this is another issue or not.
Here is my code. Only one JS file and one HTML file...
importfsfrom'fs';importhttpfrom'http';import{formidableasformidablePackage}from'formidable';constport=8080;//Will create horizontal line that will fit the width of the terminal windowconsthorizontalLine='='.repeat(process.stdout.columns);constformidable=formidablePackage({allowEmptyFiles: true,minFileSize: 0,});http.createServer(async(request,response)=>{if(request.method==='POST'){let[formFieldData,formFileData]=awaitformidable.parse(request);console.log(formFieldData);}response.setHeader('Content-Type','text/html');fs.createReadStream('form.html').pipe(response);}).listen(port);
You should create a new formidable instance on each request.
remove the formidable constant before http.createServer and use the code like the following
Support plan
Context
What are you trying to achieve or the steps to reproduce?
When I submit the form twice, three times, etc. I get duplicated form field data. Here is the console output of the form data after every submissions.
Also all the field values are always an array, even if the input field for that value is a text input field? Not sure if this is another issue or not.
Here is my code. Only one JS file and one HTML file...
What was the result you got?
These are the console logs
What result did you expect?
These are the console logs I expected
The text was updated successfully, but these errors were encountered: