Is there a way to specify a download location in Django?
My page allows the user to
- Click a button run to a EXE in the background
- Then gives the user a new page where the download option is available
- User clicks the download, and it downloads the latest file it generated
I read in a HTML post that you cannot force the browser to download a specific location. I am wondering if Django has an option that lets you do this.
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