FileController.ts 415 B

123456789101112131415161718
  1. import FileService from '../service/FileService';
  2. class FileController {
  3. private service: FileService = new FileService();
  4. upload = async (ctx) => {
  5. const files = ctx.request.files.file;
  6. console.log(files);
  7. if (files.length === undefined) {
  8. this.service.upload(ctx, files, false);
  9. } else {
  10. this.service.upload(ctx, files, true);
  11. }
  12. };
  13. }
  14. export default new FileController();