fix: 修复无法正确获取文件后缀名的问题
This commit is contained in:
@@ -22,7 +22,7 @@ def save_file(f: FileStorage, path: str, namespace: str = None, filename: str =
|
|||||||
if not os.path.exists(save_path):
|
if not os.path.exists(save_path):
|
||||||
os.makedirs(save_path)
|
os.makedirs(save_path)
|
||||||
|
|
||||||
filename = filename or '{}{}'.format(str(int(time.time() * 1000)), os.path.splitext(f.name)[-1])
|
filename = filename or '{}{}'.format(str(int(time.time() * 1000)), os.path.splitext(f.filename)[-1])
|
||||||
file_path = os.path.join(save_path, filename)
|
file_path = os.path.join(save_path, filename)
|
||||||
with open(file_path, 'wb+') as tmp_f:
|
with open(file_path, 'wb+') as tmp_f:
|
||||||
tmp_f.write(f.read())
|
tmp_f.write(f.read())
|
||||||
|
Reference in New Issue
Block a user