Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DA-Platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
文档服务地址:
http://47.92.0.57:3000/
周报索引地址:
http://47.92.0.57:3000/s/NruNXRYmV
Open sidebar
Berlin
DA-Platform
Commits
7d061cfa
Commit
7d061cfa
authored
Jul 02, 2020
by
李景熙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改中文命名文件无法上传的bug
parent
a4d383a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
uploadDownload.py
DAPlatform/views/uploadDownload.py
+2
-3
No files found.
DAPlatform/views/uploadDownload.py
View file @
7d061cfa
...
...
@@ -27,8 +27,7 @@ def upload():
os
.
makedirs
(
file_dir
)
f
=
request
.
files
[
'file'
]
# 从表单的file字段获取文件,file为该表单的name值
if
f
and
allowed_file
(
f
.
filename
):
# 判断是否是允许上传的文件类型
fName
=
secure_filename
(
f
.
filename
)
ext
=
os
.
path
.
splitext
(
fName
)[
1
]
# 获取文件后缀
ext
=
os
.
path
.
splitext
(
f
.
filename
)[
1
]
# 获取文件后缀
unix_time
=
int
(
time
.
time
())
new_filename
=
str
(
unix_time
)
+
ext
# 修改了上传的文件名
f
.
save
(
os
.
path
.
join
(
file_dir
,
new_filename
))
# 保存文件到upload目录
...
...
@@ -46,7 +45,7 @@ def download(fileName):
@uploadDownload.route
(
'/delFile'
,
methods
=
[
'POST'
])
def
delFile
():
data
=
request
.
get_json
(
silent
=
True
)
url
=
data
[
'url'
]
url
=
data
[
'url'
]
file_dir
=
os
.
path
.
join
(
basedir
,
UPLOAD_FOLDER
,
url
[
39
:])
if
not
os
.
path
.
exists
(
file_dir
):
return
jsonify
({
"code"
:
0
,
"errmsg"
:
u"failed"
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment