file = request.FILES.get('img')獲取文件對象filefile.name能夠獲取文件名code
file = request.FILES.get('img') with open('static/img/' + file.name, 'wb') as fp: for chunk in file.chunks(): fp.write(chunk)