强大的节点模块...如何在文件上传进度开始之前获取非文件字段names/values

Formidable Node module... How to get non-file field names/values before file upload progress starts

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

 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 模块的实现?

发出了 file and field 个事件。只需确保您的非文件字段位于表单中的文件字段之前,因为字段按顺序 sent/received。