Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions controllers/userControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,14 @@ const changeUserImage = async(req, res) => {
logger.info(`Changing user's image of [${req.session.userId}] ...`);
let returnResult = {};
const profileImg = req.file.path.split(`${process.env.IMG_FILE_PATH}/`)[1];
const [updatedCnt] = await UserSchema.updateUserImg(req.session.userId, profileImg);
const imagePath = profileImg.split('/')[1] + "/" + profileImg.split('/')[2]
const [updatedCnt] = await UserSchema.updateUserImg(req.session.userId, imagePath);
if(!updatedCnt){
throw new InternalServerError
}
returnResult.rc = 200;
returnResult.rcmsg = resString.SUCCESS;
returnResult.profileImg = process.env.IMG_FILE_PATH + '/' + profileImg;
returnResult.profileImg = profileFilePath + imagePath;
res.send(returnResult);
}

Expand Down