1 配置
(1)在根目录下建立media文件夹,并在其下建立pic文件夹
(2)在settings中配置目录
MEDIA_ROOT = os.path.join(BASE_DIR, "./media")
(3)views中添加
def catinfo(request):
if request.method == "POST":
f1 = request.FILES['pic1']
fname = '%s/pic/%s' % (settings.MEDIA_ROOT, f1.name)
with open(fname, 'wb') as</