diff --git a/backend/flaskApp.py b/backend/flaskApp.py
index f6a6f2c..5f1dc7e 100644
--- a/backend/flaskApp.py
+++ b/backend/flaskApp.py
@@ -1,5 +1,5 @@
from flask import Flask, send_from_directory, request, jsonify
-import os, shutil, time, threading
+import os, shutil, time, threading, datetime
from werkzeug.utils import secure_filename
from flask_cors import CORS
from pathlib import Path
@@ -33,12 +33,14 @@ def download(timestamp):
@app.post("/upload")
def upload():
+ ts = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
+ os.makedirs(UPLOAD_DIR / ts, exist_ok=True)
files = request.files.getlist("files")
saved = []
for f in files:
if not f or f.filename == "":
continue
name = secure_filename(f.filename)
- f.save(os.path.join(UPLOAD_DIR, name))
+ f.save(os.path.join(UPLOAD_DIR / ts, name))
saved.append(name)
- return jsonify({"ok": True, "count": len(saved), "files": saved})
\ No newline at end of file
+ return jsonify({"ok": True, "count": len(saved), "files": saved, "id": ts})
\ No newline at end of file
diff --git a/frontend/index.html b/frontend/index.html
index 63398b8..d7a91a8 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -1,3 +1,4 @@
+
@@ -22,6 +23,7 @@ document.getElementById("uploadBtn").addEventListener("click", async () => {
// 不要显式设置 Content-Type
});
alert("上传成功:" + JSON.stringify(res.data));
+ window.location.href = `preview.html?id=${encodeURIComponent(res.data['id'])}`;
} catch (e) {
alert("上传失败:" + (e.response?.data?.message || e.message));
} finally {