Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

507 B
Raw Blame
import multer from 'multer';
import { MAX_FILE_SIZE, MAX_FILE_COUNT } from '@core/constants';

const upload = multer({
  limits: { fileSize: MAX_FILE_SIZE },
  storage: multer.memoryStorage(),
});

export function uploadHandler(req, res, next) {
  upload.any()(req, res, err => {
    if (err) {
      return next(new Error(`File upload error: ${err.message}`));
    }

    if (req.files && req.files.length > MAX_FILE_COUNT) {
      return res.status(400).send('Too many files');
    }

    next();
  });
}