def download(file):
with open(file, 'rb') as f:
data = f.read()
bin64 = base64.b64encode(data).decode()
return f"<a href='data:application/octet-stream;base64,{bin64}' download='{os.path.basename(file)}'><input type='button' value='Download'></a>"
However it no longer works in 1.5.0 - the download doesn’t process and the browser returns an about:blank#blocked page - some kind of security feature?
I don’t think we specifically went out of our way to block this sort of behavior, but we do support a download button now, which should be a much better and stable way of doing this:
I knew of the download widget but not able to use it since I need the button in a form and I can only use one button in a form (I think this behavior should be changed?)