1
This commit is contained in:
17
api/controller_front/file.js
Normal file
17
api/controller_front/file.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const Framework = require("../../framework/node-core-framework.js");
|
||||
const ossToolService = require('../services/oss_tool_service.js');
|
||||
module.exports = {
|
||||
|
||||
'POST /file/upload_oss': async (ctx) => {
|
||||
const body = ctx.getBody();
|
||||
const { fileBase64 } = body;
|
||||
|
||||
|
||||
// base 64 转buffer
|
||||
const buffer = Buffer.from(fileBase64, 'base64');
|
||||
let result = await ossToolService.uploadStream(buffer, 'image/jpeg', 'jpg')
|
||||
|
||||
|
||||
return ctx.success(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user