save to upload folder only when option enabled

This commit is contained in:
Yukai Huang 2016-11-15 23:25:41 +08:00
parent a5dad29300
commit 8db6624ae9

6
app.js
View file

@ -406,8 +406,10 @@ app.get('/me', function (req, res) {
app.post('/uploadimage', function (req, res) {
var form = new formidable.IncomingForm();
form.uploadDir = "public/uploads";
form.keepExtensions = true;
if (config.imageUploadType === 'filesystem') {
form.uploadDir = "public/uploads";
form.keepExtensions = true;
}
form.parse(req, function (err, fields, files) {
if (err || !files.image || !files.image.path) {