mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add pictures extension to editor and canva
This commit is contained in:
parent
643d4ae2e7
commit
5eb9101084
11 changed files with 243 additions and 8 deletions
|
|
@ -3,6 +3,7 @@ from pydantic import BaseModel
|
|||
from src.services.database import check_database, learnhouseDB, learnhouseDB
|
||||
from fastapi import HTTPException, status, UploadFile
|
||||
from fastapi.responses import StreamingResponse
|
||||
import os
|
||||
|
||||
from src.services.users import PublicUser
|
||||
|
||||
|
|
@ -54,6 +55,10 @@ async def create_picture_file(picture_file: UploadFile, element_id: str):
|
|||
element_id=element_id
|
||||
)
|
||||
|
||||
# create folder for element
|
||||
if not os.path.exists(f"content/uploads/files/pictures/{element_id}"):
|
||||
os.mkdir(f"content/uploads/files/pictures/{element_id}")
|
||||
|
||||
# upload file to server
|
||||
with open(f"content/uploads/files/pictures/{element_id}/{file_id}.{file_format}", 'wb') as f:
|
||||
f.write(file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue