2
我想传递一个GET请求使用隐藏字段的几个参数,但我似乎无法将值设置为我在我的使用的参数码。我使用下面的代码在我的路线:提交一个变量作为隐藏字段的值在Express.js
app.post('/upload',function(req, res){
var fileName = "filename.extension";
res.write('<br> <form id = "download" enctype = "multipart/form-data" action = "/download" method = "get" > ' +
'<input type="hidden" name="fileName" value=""+fileName /> ' +
'<input type="submit" value="Download file" name="submit"> ' +
'</form>');
//document.getElementById('fileName').value = filePath;
}
我想尝试改变通过的getElementById隐藏字段文件名和的saveAs的价值,但是这导致错误。
有没有人有任何建议如何处理这个?
非常感谢!
我不知道excatly什么是你的预期,你想表单中的值“fileName”? – qianjiahao
http://www.w3schools.com/jsref/jsref_concat_string.asp – XGreen
是的,我需要把变量的值放在窗体中,所以我可以在/ upload路径中使用它。 A.B给出的答案。解决了这个问题,这在报价上确实是一个错误。 – Eva