Hello!
I have an issue with an application which creates (or updates) a file to download it and print it.
When the user press an ‘export’ button, two additional buttons are created. One for downloading and another one for printing.
The thing is, I press the export button, the other two buttons are created, and I download the file correctly. Then I modify some graphics on the screen and click export again, (with the two buttons already created), and then I make sure, the new overwritten file is in the server with the same title (but different data), but when it comes to download it, I get always the old version. I’ve tried to fix it but I don’t know what more to do.
Any help is appreciated, I attach the chunk of the code.
@server.route('/download/<path:doctitle>')
def downloadfile(doctitle):
return send_from_directory("",doctitle,as_attachment=True)
@app.callback(
Output('buttons_container','children'),
[Input('export-button','n_clicks')],
#some more stuff
def exportfile(n_clicks,more parameters...):
if n_clicks==None:
raise PreventUpdate
else:
document=Document()
#processing stuff...
if os.path.isdir(mydir)==False:
os.mkdir(mydir)
document.save(mydir+"/"+doctitle)
return [
html.Br(),
html.Div('Select export mode:'),
html.Br(),
html.Button('Print', id='print-button'),
html.A('Download', href="../download/mydir/doctitle)
]
1 post - 1 participant