浏览代码

switching to disk storage

master
Rich Brown 1年前
父节点
当前提交
b7a4009cca
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. +3
    -3
      routes/createRouter.js

+ 3
- 3
routes/createRouter.js 查看文件

@@ -3,8 +3,8 @@ import multer from 'multer';
// import Micropub from 'micropub-helper';
import fs from 'fs';

const storage = multer.memoryStorage();
const upload = multer({ storage });
// const storage = multer.memoryStorage();
const upload = multer({ dest: 'uploads/' });

const createRouter = express.Router();

@@ -36,7 +36,7 @@ createRouter.post('/form', upload.single('file'), (req, res) => {
name: title, // i thought MF syntax was 'p-name' but voxpelli's formattr turns NAME to TITLE
content: body,
category: arrayOfTags,
photo: fs.createReadStream(file.buffer),
photo: fs.createReadStream(`./uploads/${file.path}`),
// photo: JSON.stringify({
// filename: file.originalname,
// buffer: file.buffer,


正在加载...
取消
保存