javascript - 错误:提交文档时无法在视图目录中查找视图“索引”
问题描述
我最近将我的站点从 Google Cloud 迁移到 AWS EC2,并且我正在使用 node.js。
该网站是一个工作网站,当我尝试提交文件时,我现在收到以下错误消息。
错误:无法在视图目录中查找视图“索引”“
该提交在本地主机上运行良好(并且在托管在 GCP 上时也是如此)。请你能帮我理解为什么会这样以及如何解决它?这是提交简历的代码
if (req.file){
console.log("sending CV:"+req.file.path);
var CVLibrary = {
url: 'http://www.website.co.uk/cgi-bin/cvsubapi.pl',
formData:
{
title: title,
firstname: name,
lastname: lastName,
email: email,
county: city,
town: address2,
postcode: postCode,
telephone: phone,
salary: salary,
age: Age,
affiliateID: 20998,
industry: "Retail",
affiliatepassword: "coregalm",
currentjobtitle: jobCategories ,
doc: {
value: fs.createReadStream(req.file.path),
options: {
contentType: "application/msword",
filename: "cv.docx"
}
}
}
};
console.log("CV data:" + JSON.stringify(CVLibrary));
request.post(CVLibrary, function (error, response, body) {
if (error) {
console.log("CV Library request sent with error" + error + " body." + body);
//res.status(400).send(error);
} else {
//res.set('Content-Type', 'text/html');
//res.send(new Buffer(body));
console.log("request sent correctly CV Library:" + body);
//res.send(body)
}
});
res.render('learnnewskills', {
title: 'Welcome to job site', userInfo: {
title: title,
name,
firstname: name,
lastname: lastName,
email: email,
mobile: phone,
subAffiliate: listId,
dob: dob_day + '/' + dob_month + '/' + dob_year,
optindate: currentTimestamp,
street1: address1,
address2,
towncity: city,
postcode: postCode,
tickYes,
tickYes1,
ipaddress: ipaddress,
courseInterestYes:"",
specificCourseInterest:"",
costAwareYes:"",
currentJob,
list: listId,
currentTimestamp,
redcoursetickyes:"",
penaltyPoints:"",
DrivingBan:"",
Redlicence:""
}
});
});
解决方案
推荐阅读
- html - Bootstrap 4 与可折叠和显示实用程序的兼容性
- c# - 使用 HttpClient 如何发送 GET 请求并在更改端点的循环中返回响应
- sql - SQL查询Employee在多个部门工作的位置
- json - 我在数据库中检查数据的逻辑是否有效?
- python - 将 tf.control_dependencies 与 session.run 一起使用
- javascript - 在启用 CORS 的情况下重定向后获取图像位置?
- architecture - Why do FPGAs use LUTs rather than traditional logic gates?
- django - UpdateView 将正确显示模型数据,但不会实际保存更新
- iphone - How can i print 5 digit after floating point in Swift 4, is there any shortest way?
- php - Wordpress unable to communicate back to site