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']
@ -109,22 +109,19 @@ def test():
print("hola") print("hola")
with ZipFile(bundle, 'w') as zipObj2:
# create a ZipFile object
# Add multiple files to the zip # Add multiple files to the zip
zipObj.write('static/files/'+listofselecteddocs[0])
zipObj.write('static/files/'+listofselecteddocs[1])
zipObj.write('static/default-files/hello.txt')
# close the Zip File
# return render_template('test.html') readmeabsname = 'static/default-files/hello.txt'
# return send_file(bundle, mimetype='application/zip', as_attachment=True, attachment_filename=bundle) readmearcname = "hello.txt"
# TEST zipObj2.write(readmeabsname,readmearcname)
# print("sending file...")
# result = send_file(bundle, as_attachment=True) for doc in listofselecteddocs:
# print("file sent, deleting...") absname = 'static/files/'+doc
# os.remove(bundle) print(doc)
# return result arcname = os.path.basename(doc)
zipObj.close() zipObj2.write(absname, arcname)
return send_file(bundle, mimetype='application/zip', attachment_filename="hello.zip", as_attachment=True)
return send_file(bundle, mimetype='application/zip', attachment_filename="bundle.zip", as_attachment=True)