Closed msojocs closed 2 months ago
const form = formidable({
uploadDir: storagePath,
createDirsFromUploads: true,
keepExtensions: true,
});
form.onPart = function (part) {
log.info('part:', part)
if (part.mimetype && !(part as any).headers['content-disposition']?.match(/filename="/)) {
// we want it to be a "field" (cf https://github.com/node-formidable/formidable/issues/875 )
part.mimetype = null
}
form._handlePart(part);
}
Support plan
Context
What problem are you trying to solve?
If the 'Content-Type' was set,
formidable
wil parse the field as file.raw data:
result:
As you can see, when I set the contentType of field named peerUid(text/plain), it will be parsed as file.
Maybe we can just supprt the contentType text and file.
Do you have a new or modified API suggestion to solve the problem?