mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
upload image to public/uploads
This commit is contained in:
parent
a04c6ef127
commit
81b368c11c
3 changed files with 6 additions and 0 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -25,3 +25,6 @@ public/js/config.js
|
||||||
# ignore webpack build
|
# ignore webpack build
|
||||||
public/build
|
public/build
|
||||||
public/views/build
|
public/views/build
|
||||||
|
|
||||||
|
public/uploads/*
|
||||||
|
!public/uploads/.gitkeep
|
||||||
|
|
3
app.js
3
app.js
|
@ -405,6 +405,9 @@ app.get('/me', function (req, res) {
|
||||||
//upload to imgur
|
//upload to imgur
|
||||||
app.post('/uploadimage', function (req, res) {
|
app.post('/uploadimage', function (req, res) {
|
||||||
var form = new formidable.IncomingForm();
|
var form = new formidable.IncomingForm();
|
||||||
|
form.uploadDir = "public/uploads";
|
||||||
|
form.keepExtensions = true;
|
||||||
|
|
||||||
form.parse(req, function (err, fields, files) {
|
form.parse(req, function (err, fields, files) {
|
||||||
if (err || !files.image || !files.image.path) {
|
if (err || !files.image || !files.image.path) {
|
||||||
response.errorForbidden(res);
|
response.errorForbidden(res);
|
||||||
|
|
0
public/uploads/.gitkeep
Normal file
0
public/uploads/.gitkeep
Normal file
Loading…
Reference in a new issue