[英]Unable to display the uploaded image in express node project? Please support
want to display the image which was uploaded in server,but unfortunately not getting.想显示上传到服务器的图片,可惜没有。 Image is uploaded successfully in server and changed the name in express project folder,but while fetching not getting the image.
图像已成功上传到服务器并更改了 express 项目文件夹中的名称,但在获取图像时未获取图像。 Additional route path is coming in front of image while fetching.Image is stored in server in this path "public/images/1670147053485apic.jpg"
附加路由路径在获取时出现在图像前面。图像存储在此路径“public/images/1670147053485apic.jpg”中的服务器中
please find my route file users.js below:请在下面找到我的路由文件 users.js:
router.get('/display', (req, res) => {
sql = `SELECT * FROM product`
db.query(sql, (err, result) => {
if (err) throw err
res.render('insertDisplay', { data: result })
})
})
also insertDisplay.hbs details below:下面还有 insertDisplay.hbs 的详细信息:
<table>
<thead>
<tr>
<th>Product</th>
<th>Category</th>
<th>Time</th>
<th>Image</th>
</tr>
</thead>
<tbody>
{{#each data}}
<tr>
<td>{{this.Product}}</td>
<td>{{this.Category}}</td>
<td>{{this.date}}</td>
<td><img src="{{this.Image}}"></td>
</tr>
{{/each}}
</tbody>
</table>
In running log am getting GET /users/1670147053485apic.jpg 404 103.009 ms - 1407在运行日志中得到 GET /users/1670147053485apic.jpg 404 103.009 ms - 1407
but not displaying any image但不显示任何图像
Issue Resolved:- (Express-Generator,Handlebars,MySql these are my working environment)
已解决的问题:-(Express-Generator、Handlebars、MySql 这些是我的工作环境)
My express app structure, images stored in 'public/images' location.我的 express 应用程序结构,图像存储在“public/images”位置。
Thanks for support -Konrad,Tiddo感谢支持-Konrad,Tiddo
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.