This commit is contained in:
ccl 2020-10-14 17:07:05 +02:00
commit 3811f67885

View File

@ -99,7 +99,7 @@ def test():
print("test") print("test")
clicked=None clicked=None
bundle = "bundle.zip" bundle = "bundle.zip"
zipObj = ZipFile(bundle, 'w') # zipObj = ZipFile(bundle, 'w')
if request.method == "POST": if request.method == "POST":
# clicked=request.form['data'] # clicked=request.form['data']
@ -108,23 +108,20 @@ def test():
print(listofselecteddocs) print(listofselecteddocs)
print("hola") print("hola")
# create a ZipFile object with ZipFile(bundle, 'w') as zipObj2:
# Add multiple files to the zip # Add multiple files to the zip
zipObj.write('static/files/'+listofselecteddocs[0])
zipObj.write('static/files/'+listofselecteddocs[1]) readmeabsname = 'static/default-files/hello.txt'
zipObj.write('static/default-files/hello.txt') readmearcname = "hello.txt"
# close the Zip File zipObj2.write(readmeabsname,readmearcname)
# return render_template('test.html') for doc in listofselecteddocs:
# return send_file(bundle, mimetype='application/zip', as_attachment=True, attachment_filename=bundle) absname = 'static/files/'+doc
# TEST print(doc)
# print("sending file...") arcname = os.path.basename(doc)
# result = send_file(bundle, as_attachment=True) zipObj2.write(absname, arcname)
# print("file sent, deleting...")
# os.remove(bundle)
# return result
zipObj.close() return send_file(bundle, mimetype='application/zip', attachment_filename="bundle.zip", as_attachment=True)
return send_file(bundle, mimetype='application/zip', attachment_filename="hello.zip", as_attachment=True)