Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ app = FastAPI()
|
|
20 |
UPLOAD_DIR = "uploads"
|
21 |
os.makedirs(UPLOAD_DIR, exist_ok=True)
|
22 |
|
23 |
-
@app.post("/upload-dropzone/")
|
24 |
def upload_file(
|
25 |
file: UploadFile = File(...),
|
26 |
chunkIndex: int = Form(...),
|
@@ -37,7 +37,7 @@ def upload_file(
|
|
37 |
# Save the chunk
|
38 |
chunk_path = target_dir / f"{fileName}.part{chunkIndex}"
|
39 |
with open(chunk_path, "wb") as f:
|
40 |
-
f.write(file.read())
|
41 |
|
42 |
# If it's the last chunk, reconstruct the file
|
43 |
if chunkIndex + 1 == totalChunks:
|
|
|
20 |
UPLOAD_DIR = "uploads"
|
21 |
os.makedirs(UPLOAD_DIR, exist_ok=True)
|
22 |
|
23 |
+
async @app.post("/upload-dropzone/")
|
24 |
def upload_file(
|
25 |
file: UploadFile = File(...),
|
26 |
chunkIndex: int = Form(...),
|
|
|
37 |
# Save the chunk
|
38 |
chunk_path = target_dir / f"{fileName}.part{chunkIndex}"
|
39 |
with open(chunk_path, "wb") as f:
|
40 |
+
f.write(await file.read())
|
41 |
|
42 |
# If it's the last chunk, reconstruct the file
|
43 |
if chunkIndex + 1 == totalChunks:
|