Skip to content

Commit

Permalink
proud of myslef
Browse files Browse the repository at this point in the history
  • Loading branch information
gachouchani1999 committed Sep 19, 2021
1 parent 2c6ea49 commit a9120cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
Binary file added MYSELF.docx
Binary file not shown.
Binary file added Myself.pptx
Binary file not shown.
16 changes: 9 additions & 7 deletions flaskr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from werkzeug.utils import secure_filename
from flask import Flask, send_file
from . import doc_reader
from . import requesting


app = Flask(__name__, instance_relative_config=True)
Expand All @@ -15,26 +16,27 @@ def upload_file():


@app.route('/uploader', methods=['GET', 'POST'])

def index():
if request.method == 'POST':
global file_name
f = request.files['file']
requesting.store_file(f)
file_name = f.filename
file_name = file_name.replace(" ","_")
theme = request.form['theme']
f.filename = f.filename.replace(" ","_")
f.filename = f.filename.replace("(","")
f.filename = f.filename.replace(")","")
f.save(secure_filename(f.filename))
doc_reader.final_create(int(theme),f.filename)
file_name = file_name.replace(" ","_")
file_name = file_name.replace("(","")
file_name = file_name.replace(")","")
f.save(secure_filename(file_name))
doc_reader.final_create(int(theme),file_name)

return render_template('download.html')



@app.route('/download')
def download():

file_name = requesting.store_file()
filename_new = file_name[:file_name.find('.')]
path = '../'+filename_new + '.pptx'
return send_file(path, as_attachment=True)
Expand Down
5 changes: 5 additions & 0 deletions flaskr/requesting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from flask import request
def store_file(*file):
for f in file:
store_file.file_name = str(f.filename)
return store_file.file_name

0 comments on commit a9120cc

Please sign in to comment.