storage-upload/api/media/routes.js

15 lines
331 B
JavaScript
Raw Normal View History

2017-12-10 09:45:38 +00:00
import config from '../../config'
import { verifyToken } from './security'
import { uploadFile, rename } from './multer'
export async function upload(ctx) {
let site = await verifyToken(ctx)
let result = await uploadFile(ctx, site)
ctx.body = {
filename: result.filename,
path: `/${site}/${result.filename}`
}
}