How to display image which was uploaded by Multer when query data with Mongoose of each different users
up vote
0
down vote
favorite
I have uploaded an image using multer of each and every user registering on my app and everything is okay with it. But how to display that particular image in the frontend page when a particular user is logged in? i have saved the images in ./public/images
this ia a small part of my code register.js
//post request
router.post('/register', multer(multerConfig).single('profileimage') ,function(req, res, next) {
var name = req.body.name;
var email = req.body.email;
var username = req.body.username;
var password = req.body.password;
var password2 = req.body.password2;
if(req.file){
console.log('Uploading File...');
var profileimage = req.file.filename;
}
else {
console.log('No File Uploaded...');
var profileimage = 'noimage.jpg';
}
Thankyou in advance
node.js image upload multer
New contributor
add a comment |
up vote
0
down vote
favorite
I have uploaded an image using multer of each and every user registering on my app and everything is okay with it. But how to display that particular image in the frontend page when a particular user is logged in? i have saved the images in ./public/images
this ia a small part of my code register.js
//post request
router.post('/register', multer(multerConfig).single('profileimage') ,function(req, res, next) {
var name = req.body.name;
var email = req.body.email;
var username = req.body.username;
var password = req.body.password;
var password2 = req.body.password2;
if(req.file){
console.log('Uploading File...');
var profileimage = req.file.filename;
}
else {
console.log('No File Uploaded...');
var profileimage = 'noimage.jpg';
}
Thankyou in advance
node.js image upload multer
New contributor
Welcome to StackOverflow! Please provide a Minimal, Complete, and Verifiable example of what you've tried so far so we can reproduce your issue.
– Joseph Cho
21 mins ago
hello joseph...
– Rahul Mahajan
4 mins ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have uploaded an image using multer of each and every user registering on my app and everything is okay with it. But how to display that particular image in the frontend page when a particular user is logged in? i have saved the images in ./public/images
this ia a small part of my code register.js
//post request
router.post('/register', multer(multerConfig).single('profileimage') ,function(req, res, next) {
var name = req.body.name;
var email = req.body.email;
var username = req.body.username;
var password = req.body.password;
var password2 = req.body.password2;
if(req.file){
console.log('Uploading File...');
var profileimage = req.file.filename;
}
else {
console.log('No File Uploaded...');
var profileimage = 'noimage.jpg';
}
Thankyou in advance
node.js image upload multer
New contributor
I have uploaded an image using multer of each and every user registering on my app and everything is okay with it. But how to display that particular image in the frontend page when a particular user is logged in? i have saved the images in ./public/images
this ia a small part of my code register.js
//post request
router.post('/register', multer(multerConfig).single('profileimage') ,function(req, res, next) {
var name = req.body.name;
var email = req.body.email;
var username = req.body.username;
var password = req.body.password;
var password2 = req.body.password2;
if(req.file){
console.log('Uploading File...');
var profileimage = req.file.filename;
}
else {
console.log('No File Uploaded...');
var profileimage = 'noimage.jpg';
}
Thankyou in advance
node.js image upload multer
node.js image upload multer
New contributor
New contributor
edited 51 secs ago
New contributor
asked 46 mins ago
Rahul Mahajan
1
1
New contributor
New contributor
Welcome to StackOverflow! Please provide a Minimal, Complete, and Verifiable example of what you've tried so far so we can reproduce your issue.
– Joseph Cho
21 mins ago
hello joseph...
– Rahul Mahajan
4 mins ago
add a comment |
Welcome to StackOverflow! Please provide a Minimal, Complete, and Verifiable example of what you've tried so far so we can reproduce your issue.
– Joseph Cho
21 mins ago
hello joseph...
– Rahul Mahajan
4 mins ago
Welcome to StackOverflow! Please provide a Minimal, Complete, and Verifiable example of what you've tried so far so we can reproduce your issue.
– Joseph Cho
21 mins ago
Welcome to StackOverflow! Please provide a Minimal, Complete, and Verifiable example of what you've tried so far so we can reproduce your issue.
– Joseph Cho
21 mins ago
hello joseph...
– Rahul Mahajan
4 mins ago
hello joseph...
– Rahul Mahajan
4 mins ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Rahul Mahajan is a new contributor. Be nice, and check out our Code of Conduct.
Rahul Mahajan is a new contributor. Be nice, and check out our Code of Conduct.
Rahul Mahajan is a new contributor. Be nice, and check out our Code of Conduct.
Rahul Mahajan is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53343176%2fhow-to-display-image-which-was-uploaded-by-multer-when-query-data-with-mongoose%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Welcome to StackOverflow! Please provide a Minimal, Complete, and Verifiable example of what you've tried so far so we can reproduce your issue.
– Joseph Cho
21 mins ago
hello joseph...
– Rahul Mahajan
4 mins ago