有没有办法在Django中指定下载位置?在
我的页面允许用户
{a1}你不能在一个特定的位置强制下载一个HTML。我想知道Django是否有一个选项可以让您这样做。在
def DownloadZip(request, zipname, prodVersID):
print(zipname)
zip_path = "C:/fbw/firmware/main/sys/" + zipname
zip_file = open(zip_path, 'rb')
response = HttpResponse(zip_file, content_type='application/zip')
response['Content-Disposition'] = 'attachment; filename=%s' %zipname
response['Content-Length'] = os.path.getsize(zip_path)
zip_file.close()
return response
经过进一步的研究,我得出结论,引用post也反映在Django上。Django不提供这样的功能,它是web浏览器的一个安全特性,不允许您指定下载位置。在
记入Darren
相关问题 更多 >
编程相关推荐