file = request.FILES.get(‘img’) 获取文件对象 file
file.name 能够获取文件名
file = request.FILES.get('img')
with open('static/img/' + file.name, 'wb') as fp:
for chunk in file.chunks():
fp.write(chunk)
file = request.FILES.get(‘img’) 获取文件对象 file
file.name 能够获取文件名
file = request.FILES.get('img')
with open('static/img/' + file.name, 'wb') as fp:
for chunk in file.chunks():
fp.write(chunk)