i can now upload images to my server. Now i want to display the same image in a div container automatically.
i dont wanna use this <img src= "image.png">
how i can realize that? I have to use only node and javascript
this is my code for upload and it works
server.use(upload())
server.get('/', (req, res) =>{
res.sendFile(__dirname + '/home.html')
})
server.post('/', (req,res)=>{
if(req.files){
console.log(req.files)
var file = req.files.file
var filename = file.name
console.log(filename)
file.mv('./upload/' + filename, function(err){
if(err){
res.send(err)
}else{
res.send("File Uploaded")
}
})
}
});
this is my html where i want my image
<div class="wrapper">
<h2><legend>Your image here</h2>
</div>