Fix for image uploads

- express 3.4.0 uses connect 2.9.0 which had a sizable change to how multipart woks
- this change resulting in req.files.uploadimage.type going away
This commit is contained in:
Hannah Wolfe 2013-10-11 20:26:09 +01:00
parent c732cd2ccb
commit b4e04b3650

View File

@ -79,7 +79,7 @@ adminControllers = {
imagespath = path.join(ghost.paths().appRoot, 'content/images'),
dir = path.join(imagespath, year, month),
ext = path.extname(req.files.uploadimage.name).toLowerCase(),
type = req.files.uploadimage.type,
type = req.files.uploadimage.type || req.files.uploadimage.headers['content-type'],
basename = path.basename(req.files.uploadimage.name, ext).replace(/[\W]/gi, '_');
function renameFile(target_path) {