plus de redirect débiles

This commit is contained in:
piair 2023-08-21 20:46:09 +02:00
parent 8f5a1ac705
commit 494a58593b
1 changed files with 3 additions and 2 deletions

View File

@ -421,16 +421,17 @@ def allowed_file(filename):
@login_required @login_required
def upload_file(): def upload_file():
print(request.files) print(request.files)
print(request)
# check if the post request has the file part # check if the post request has the file part
if 'file' not in request.files: if 'file' not in request.files:
print('No file part') print('No file part')
return redirect('settings') return redirect(url_for('settings'))
file = request.files['file'] file = request.files['file']
# If the user does not select a file, the browser submits an # If the user does not select a file, the browser submits an
# empty file without a filename. # empty file without a filename.
if file.filename == '': if file.filename == '':
print('No selected file') print('No selected file')
return redirect('settings') return redirect(url_for('settings'))
if file and allowed_file(file.filename): if file and allowed_file(file.filename):
filename = secure_filename(file.filename) filename = secure_filename(file.filename)
file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename)) file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename))