I used multer to download the image and save the path of the image to the database, and then how can I get the image from the client and show it on the screen?
import multer from 'multer';
const storageConfig = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, './images')
},
filename: (req, file, cb) => {
cb(null, Date.now() + '-' + file.originalname)
}
})
const upload = multer({storage: storageConfig});
let path = '';
app.post('/upload',upload.single('image'), (req, res) => {
res.setHeader('Access-Control-Allow-Origin', '
http://localhost:3000');
/>
if(req.file) {
console.log(req.file);
path = req.file.path;
res.send('hi')
return;
}
res.send('bye')
})
after I received the file path I saved it in the database, but I don’t know how to use it later to show this picture on the screen
Getting an image from the database using path images on the client side
Programing Coderfunda
November 10, 2023
No comments
Related Posts:
What to Expect This Week from Laracon US 2023Whether you are attending the first Laracon US since 2019 or watching from the sidelines, this week will be an amazing week for the Laravel community.… Read More
Is it necessary to unsubscribe from a combineLatest within a forkJoin?According to the RXJS documentation itself, from what I understood, the forkJoin, when finishing all the calls, it gives completed(), which automatica… Read More
Dynamic Head and Footer InformationI need to append some information & tag so that admin user can add meta, title information of page dynamically. I tried storing information in my… Read More
See Laravel Folio and Laravel Volt in actionsubmitted by /u/00ProBoy00 [link] [comments]… Read More
Concepts: checking signatures of methods with argumentsI've been playing around with concepts. Here's a minimal example where I'm trying to create a concept based on method signatures: template concept bo… Read More
0 comments:
Post a Comment
Thanks