Spaces:
Running
Running
import shutil | |
from typing import Any | |
from fastapi import HTTPException, UploadFile | |
from fastapi.responses import JSONResponse | |
from src.modules.uploadDocument.features.uploadDocument_feature import \ | |
UploadDocumentFeature | |
class FileUploadController: | |
async def handle_file_upload(self, file: UploadFile) -> Any: | |
try: | |
print(file) | |
result = await UploadDocumentFeature.uploadFile(file) | |
message = result.get("message", "No message provided") | |
return JSONResponse( | |
status_code=200, content={"message": message} | |
) | |
except Exception as e: | |
raise HTTPException(status_code=500, detail=str(e)) | |