The following snippet send a file to the browser.
# Prepare selected file for download...
filename = request.form.get('filename')
filepath = '/home/nikos/wsgi/static/files/'
return send_from_directory( filepath, filename )
What if i want to print some lines before sending the file, as in:
# Prepare selected file for download...
pdata = pdata + '''Your file will be ready for download'''
padata = pdata + '''it will just atake a moment'''
filename = request.form.get('filename')
filepath = '/home/nikos/wsgi/static/files/'
return send_from_directory( filepath, filename )
if i try to add pdata + reponse like:
return pdata + send_from_directory( filepath, filename )
i get an error that return should return a string only not string + response