Skip to content

Commit c20523a

Browse files
committed
fix the uploadimage form
Signed-off-by: hcyuser <user@hcy.idv.tw>
1 parent c4f607f commit c20523a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/imageRouter/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ imageRouter.post('/uploadimage', function (req, res) {
3737
form.keepExtensions = true
3838

3939
form.parse(req, function (err, fields, files) {
40-
if (err || !files.image || !files.image.path) {
40+
if (err || !files.image || !files.image.filepath) {
4141
response.errorForbidden(req, res)
4242
} else {
4343
if (config.debug) {
4444
logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image))
4545
}
4646

47-
if (!checkImageValid(files.image.path)) {
47+
if (!checkImageValid(files.image.filepath)) {
4848
return response.errorForbidden(req, res)
4949
}
5050

5151
const uploadProvider = require('./' + config.imageUploadType)
52-
uploadProvider.uploadImage(files.image.path, function (err, url) {
52+
uploadProvider.uploadImage(files.image.filepath, function (err, url) {
5353
// remove temporary upload file, and ignore any error
54-
fs.unlink(files.image.path, () => {})
54+
fs.unlink(files.image.filepath, () => {})
5555
if (err !== null) {
5656
logger.error(err)
5757
return res.status(500).end('upload image error')
@@ -62,4 +62,4 @@ imageRouter.post('/uploadimage', function (req, res) {
6262
})
6363
}
6464
})
65-
})
65+
})

0 commit comments

Comments
 (0)