views.py
from django.shortcuts import render
from django.http import StreamingHttpResponse
# Create your views here.
def index(request):
return render(request, 'index.html')
def upload(request):
res = StreamingHttpResponse(open('/home/ouzijun/ouzijun/Django_postgresSQL/django_postgressql/allpaper.jpg', 'rb'))
res['content_type'] = 'applocation/octet-stream'
res['Content-Disposition'] = 'attachment;filename=chen.jpg'
return res