MCPcopy Create free account
hub / github.com/LangGraph-GUI/LangGraph-GUI-backend / upload_file

Function upload_file

src/FileTransmit.py:67–80  ·  view source on GitHub ↗
(username: str, files: List[UploadFile] = File(...))

Source from the content-addressed store, hash-verified

65# Route to handle file uploads with username
66@file_router.post('/upload/{username}')
67async def upload_file(username: str, files: List[UploadFile] = File(...)):
68 user_workspace = get_or_create_workspace(username)
69
70 if not files:
71 raise HTTPException(status_code=400, detail="No files selected for uploading")
72
73 # Save each uploaded file to the user's workspace
74 for file in files:
75 file_path = os.path.join(user_workspace, file.filename)
76 with open(file_path, 'wb') as f:
77 f.write(await file.read())
78 print(f"Uploaded file: {file.filename} to {user_workspace}")
79
80 return JSONResponse(content={"message": "Files successfully uploaded"}, status_code=200)
81
82# Route to handle cleaning the user's workspace
83@file_router.post('/clean-cache/{username}')

Callers

nothing calls this directly

Calls 2

get_or_create_workspaceFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected