path join on user routers

v1.18.x
Baris Soner Usakli 12 years ago
parent b962972d21
commit 626423e01b

@ -113,8 +113,7 @@ var user = require('./../user.js'),
return; return;
} }
var filename = path.basename(oldpicture); var absolutePath = path.join(global.configuration['ROOT_DIRECTORY'], config.upload_path, path.basename(oldpicture));
var absolutePath = global.configuration['ROOT_DIRECTORY'] + config.upload_path + filename;
fs.unlink(absolutePath, function(err) { fs.unlink(absolutePath, function(err) {
if(err) { if(err) {
@ -124,9 +123,7 @@ var user = require('./../user.js'),
uploadUserPicture(req.user.uid, req.files.userPhoto.name, req.files.userPhoto.path, res); uploadUserPicture(req.user.uid, req.files.userPhoto.name, req.files.userPhoto.path, res);
}); });
}); });
}); });
function uploadUserPicture(uid, filename, tempPath, res) { function uploadUserPicture(uid, filename, tempPath, res) {
@ -165,8 +162,10 @@ var user = require('./../user.js'),
dstPath: global.configuration['ROOT_DIRECTORY'] + uploadPath, dstPath: global.configuration['ROOT_DIRECTORY'] + uploadPath,
width: 128 width: 128
}, function(err, stdout, stderr){ }, function(err, stdout, stderr){
if (err) if (err) {
console.log(err);
throw err; throw err;
}
}); });
}); });

Loading…
Cancel
Save