upload image to public/uploads

This commit is contained in:
Yukai Huang 2016-11-14 16:45:57 +08:00
parent a04c6ef127
commit 81b368c11c
3 changed files with 6 additions and 0 deletions

3
.gitignore vendored
View file

@ -25,3 +25,6 @@ public/js/config.js
# ignore webpack build
public/build
public/views/build
public/uploads/*
!public/uploads/.gitkeep

3
app.js
View file

@ -405,6 +405,9 @@ app.get('/me', function (req, res) {
//upload to imgur
app.post('/uploadimage', function (req, res) {
var form = new formidable.IncomingForm();
form.uploadDir = "public/uploads";
form.keepExtensions = true;
form.parse(req, function (err, fields, files) {
if (err || !files.image || !files.image.path) {
response.errorForbidden(res);

0
public/uploads/.gitkeep Normal file
View file