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