如何在nodejs中更改csv文件路径的文件路径。 我希望它获取具有相应名称的复选框的值并将其放在此处:
const csvFilePath = "./uploads/Core Front End -Membership Services - defects.csv";
而不是硬编码文件名
这是需要变量
的post函数var stream = fs.createReadStream(csvFilePath);
router.get('/import', function(req, res, next) {
var csvup = []
var csvStream = fastCsv()
.on('data', function(data) {
var report = new csvUploads({
jirakey: data[0],
status: data[1],
priority: data[2],
validity: data[3],
type: data[4],
month: data[5],
defectCategory: data[6],
defectSubCategory: data[7]
});
report.save(function(error) {
console.log(report);
if (error) {
throw error;
}
});
}).on('end', function() {});
stream.pipe(csvStream);
res.json({
success: 'Data imported successfully',
status: 200
});
});
这是我想从中获取值的单选按钮,我也想得到下拉框的值\
label.radio-inline
input(type='radio' name="team" value="CCP" id="1")
| CCP
label.radio-inline
input(type='radio' name="team" value="WMP" id="2")
| WMP
label.radio-inline
input(type='radio' name="team" value="ELT" id="3")
| ELT
label.radio-inline
input(type='radio' name="team" value="Central QA" id="4")
| Central QA
label.radio-inline
input(type='radio' name="team" value="Global Education" id="5")
| Global Education
label.radio-inline
input(type='radio' name="team" value="Mobile" id="6")
| Mobile
label.radio-inline
input(type='radio' name="team" value="Data Services" id="7")
| Data Services
label.radio-inline
input(type='radio' name="team" value="CA" id="8")
| CA
label.radio-inline
input(type='radio' name="team" value="SAP" id="9")
| SAP
br
br
label.col-sm-4.control-label(style='color:white')
.col-sm-4(align='center')
select.form-control.m-b(name='account')
option Choose Month ...
option January
option February
option March
option April
option May
option June
option July
option August
option September
option Ocotber
option November
option December