okok
This commit is contained in:
parent
18f0f3ec02
commit
9b411fe54e
46
Flask/app.py
46
Flask/app.py
|
@ -417,36 +417,26 @@ def allowed_file(filename):
|
||||||
return '.' in filename and \
|
return '.' in filename and \
|
||||||
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||||
|
|
||||||
@app.route('/upload_file/', methods=['POST', "GET"])
|
@app.route('/upload_file/', methods=['POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def upload_file():
|
def upload_file():
|
||||||
if request.method == 'POST':
|
print(request.files)
|
||||||
print(request.files)
|
print(request)
|
||||||
print(request)
|
# check if the post request has the file part
|
||||||
# check if the post request has the file part
|
if 'file1' not in request.files:
|
||||||
if 'file' not in request.files:
|
print('No file part')
|
||||||
print('No file part')
|
#return redirect(url_for('settings_get'))
|
||||||
#return redirect(url_for('settings_get'))
|
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(url_for('settings_get'))
|
||||||
#return redirect(url_for('settings_get'))
|
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))
|
#return redirect(url_for('settings_get'))
|
||||||
#return redirect(url_for('settings_get'))
|
|
||||||
return '''
|
|
||||||
<!doctype html>
|
|
||||||
<title>Upload new File</title>
|
|
||||||
<h1>Upload new File</h1>
|
|
||||||
<form method=post action="/upload_file/" enctype=multipart/form-data>
|
|
||||||
<input type="file" name="file1">
|
|
||||||
<input type="file" name="file2">
|
|
||||||
<input type=submit value=Upload>
|
|
||||||
</form>
|
|
||||||
'''
|
|
||||||
|
|
||||||
def maxi(dict):
|
def maxi(dict):
|
||||||
m = 0
|
m = 0
|
||||||
|
|
|
@ -75,8 +75,8 @@
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<form method="POST" action="/upload_file/" enctype=multipart/form-data>
|
<form method="POST" action="/upload_file/" enctype=multipart/form-data>
|
||||||
<input type="file" id="file1">
|
<input type="file" id="file1" name="file1">
|
||||||
<input type="file" id="file2">
|
<input type="file" id="file2" name="file2">
|
||||||
<input type="submit" name="settings" id="submit" value="send file" class="button"/>
|
<input type="submit" name="settings" id="submit" value="send file" class="button"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue