This commit is contained in:
piair 2023-08-21 20:53:07 +02:00
parent 259a3ad713
commit 597840d132
1 changed files with 17 additions and 16 deletions

View File

@ -420,22 +420,23 @@ def allowed_file(filename):
@app.route('/upload_file/', methods=['POST', "GET"]) @app.route('/upload_file/', methods=['POST', "GET"])
@login_required @login_required
def upload_file(): def upload_file():
print(request.files) if request.method == 'POST':
print(request) print(request.files)
# check if the post request has the file part print(request)
if 'file' not in request.files: # check if the post request has the file part
print('No file part') if 'file' not in request.files:
#return redirect(url_for('settings_get')) print('No file part')
file = request.files['file'] #return redirect(url_for('settings_get'))
# If the user does not select a file, the browser submits an file = request.files['file']
# empty file without a filename. # If the user does not select a file, the browser submits an
if file.filename == '': # empty file without a filename.
print('No selected file') if file.filename == '':
#return redirect(url_for('settings_get')) print('No selected file')
if file and allowed_file(file.filename): #return redirect(url_for('settings_get'))
filename = secure_filename(file.filename) if file and allowed_file(file.filename):
file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename)) filename = secure_filename(file.filename)
#return redirect(url_for('settings_get')) file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename))
#return redirect(url_for('settings_get'))
return ''' return '''
<!doctype html> <!doctype html>
<title>Upload new File</title> <title>Upload new File</title>