Formidable Node模块...如何在文件上载进度开始之前获取非文件字段名称/值

时间:2016-07-26 11:10:54

标签: node.js formidable

我正在使用Node的强大模块进行表单处理。工作完美。现在,我需要访问文件上载开始之前发布的非文件字段名称/值。字段名称/值仅在文件上载完成后可用。有没有办法在文件上传开始之前获取字段名称?

 formProcess = new formidable.IncomingForm();
 ...
 formProcess.parse(req, function(error, myFields, myFiles) {

    //I get access to the field values here...
    //But only after the files are uploaded. 
    //I need this info before the file uploads start.
 }
 ..
 formProcess.on('progress', function(alreadyReceived, expectedToRcv) {
   //Fileupload progress info available here...
   //I need field names here while processing the upload progress.
   //Application specific requirement...
 }

这是否与http post方法的工作原理有关,还是特定于Node的Formidable模块的实现?

1 个答案:

答案 0 :(得分:1)

发出了filefield个事件。只需确保您的非文件字段位于表单中的文件字段之前,因为字段是按顺序发送/接收的。

相关问题