forked from mirror/MrDoc
图片文件名精确到微秒,避免同一秒并发上传导致文件名称重复
This commit is contained in:
parent
7738362792
commit
a2b8ad715f
@ -241,7 +241,7 @@ def base_img_upload(files,dir_name, user):
|
||||
|
||||
files_base = base64.b64decode(files_str) # 进行base64编码
|
||||
relative_path = upload_generation_dir(dir_name)
|
||||
file_name = str(datetime.datetime.today()).replace(':', '').replace(' ', '_').split('.')[0] + extensionName # 日期时间
|
||||
file_name = str(datetime.datetime.today()).replace(':', '').replace(' ', '_').replace('.', '_') + extensionName # 日期时间
|
||||
path_file = os.path.join(relative_path, file_name)
|
||||
path_file = settings.MEDIA_ROOT + path_file
|
||||
# print('文件路径:', path_file)
|
||||
|
Loading…
Reference in New Issue
Block a user