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:
Junges Laravel ACL Packages Junges Laravel ACL is a package by Mateus Junges that helps you to associate users with permissions and permission groups.This package… Read More
Laravel Blade Filters Package Blade Filters is a package by Gergo D. Nagy that adds the concept of filters to your blade templates. If you’re familiar with Dja… Read More
Laravel Google Translate Laravel Google Translate is a package that provides an artisan console command to translate your localization files with the Google translation … Read More
MailEclipse: Laravel Mail Editor Package MailEclipse is a mailable editor package for your Laravel applications to create and manage mailables using a web UI. You can use this package t… Read More
Laravel Money Laravel Money is a composer package by Ricardo Gobbo de Souza for working with and formatting money in Laravel projects.Laravel money uses the&n… Read More
0 comments:
Post a Comment
Thanks