Files
VDES_Backend/code/system/apis/vdes/chat/common.py

25 lines
743 B
Python
Raw Normal View History

2026-07-13 15:37:05 +08:00
from ninja import Router
from ninja import Router, UploadedFile, File
import os
from fuadmin import settings
router = Router()
# @router.get("/uploadFile")
# def upload_file(request, files: list[UploadedFile] = File(...)):
# file_list = []
# upload_dir = os.path.join(settings.BASE_DIR, 'upload')
# os.makedirs(upload_dir, exist_ok=True)
# for file in files:
# new_path = os.path.join(upload_dir, file.name)
# with open(new_path, 'wb+') as destination:
# for chunk in file.chunks():
# destination.write(chunk)
# file_list.append({
# 'name': file.name,
# 'path': new_path,
# 'size': file.size
# })
# return file_list