Multipart/form-data with arrays ---------- // ------------------ ---獲取數組值具有語言的Multipart/form-data
我無法獲得值「fields.c」。
*---------------html form
<form action="/companyInfo" method="post" enctype="multipart/form-data">
<input type="text" name='txtCompanyPhone' value='0909 234 456' />
<input type="text" name='txtCompanyName[vi]' value='Namevi' />
<input type="text" name='txtCompanyName[en]' value='Nameen' />
<input type="text" name='txtCompanyName[ja]' value='Nameja' />
</form>
*---------------controller "companyInfo"
var form = new multiparty.Form();
form.parse(req, function(err, fields, files) {
console.log(fields);
//result
// txtCompanyPhone: ['0909 234 456'],
// ,'txtCompanyName[vi]': ['Namevi'],
// ,'txtCompanyName[en]': ['Nameen'],
// ,'txtCompanyName[ja]': ['Nameja'],
console.log(fields.txtCompanyPhone);
result------ ['0909 234 456']
console.log(fields.txtCompanyName[vi]);
//result ----- error
var c = 'txtCompanyName[vi]';
console.log(fields.c);
//result ------undefined
//----------Help me show results-----------------
}
如何在此表單中獲取值「fields.c」或「fields.txtCompanyName [vi]」?
相關的問題:https://github.com/pillarjs/multiparty/issues/81 –