提交所有内容

This commit is contained in:
super
2026-03-22 12:45:58 +08:00
parent 0d83d56a05
commit 923dfd2495
9 changed files with 39 additions and 8 deletions

View File

@@ -211,7 +211,7 @@ class WindowAPI:
except Exception as e:
return {'success': False, 'error': str(e)}
def upload_file_to_java(self, file_path):
def upload_file_to_java(self, file_path, relative_path=None):
"""按本地路径读取文件并上传到 Java 后端临时目录。"""
if not file_path or not str(file_path).strip():
return {'success': False, 'error': '文件路径为空'}
@@ -223,6 +223,7 @@ class WindowAPI:
response = requests.post(
f"{JAVA_API_BASE}/api/files/upload",
files={'file': (os.path.basename(normalized_path), file_obj)},
data={'relativePath': str(relative_path).strip()} if relative_path else None,
timeout=120,
)
response.raise_for_status()