How not to upload with form.parse() ?
See original GitHub issueContext
- node version: 12.14.1
- module (formidable) version: canary
- environment (e.g. node, browser, native, OS): Nodenv, Chrome, WSL2, Win10 Pro
- used with (i.e. popular names of modules): express, mysql
- any other relevant information: -
What problem are you trying to solve?
I have a problem with using formidable, it’s a simple but I can’t find any site with this problem.
“In case I have a upload webapp with formidable, how not to upload an empty file? It always upload an empty file, title like upload_3f0934128511fd38dha1… and no content”
I’m using this module like below in expressJS
router.post('/compose', async function (req, res, next) {
if (req.body.imgFile == undefined ) { // no upload }
else {
form.parse(req, async (err, fields, files) => {
// some business logic
}
}
but it doesn’t work anyway. I think form.parse()
has no option to not upload.
So if form.parse() in formidable
has a function to make webapp upload or not, plz comment below. Or same function with same feature, plz comment
thx
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (10 by maintainers)
Top Results From Across the Web
Formidable doesnt form.parse() when uploading a file in Nodejs
On the Internet I read that this is because I use bodyParser(), and people suggested to do this: delete express.bodyParser.parse['multipart/form-data'];.
Read more >Uploading Files using Formidable in a Node.js Application
In this article, we will learn how we can upload files using node.js, express, and formidable. Formidable is a Node.js module for parsing...
Read more >Null in Parse JSON when Upload in Forms is Optional
Hi Thomas, Try moving the parse JSON step to the "If No" side of the condition. Right now your flow says, if there's...
Read more >Differences between formidable callbacks, events ... - Medium
Formidable is a NodeJS module to uploading files. ... Cause formidable is not a promise. ... parseAsync() instead of form.parse() .
Read more >Top 5 formidable Code Examples - Snyk
flow: function (req, res, next) { var form = new formidable.IncomingForm(), userSlug = slug(req.headers['uid']), uploadDir = './uploads/' + userSlug; fs.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the callback to
parse
cannot be async function, yea, use the event API.I think can be removed as a pinned issue in this repository.