I am developing an app using Flask, In the app, user upload files to the server, before uploading I used to check that user is authenticated or not. If the user is authenticated, then the uploading file is saved in the server otherwise flask redirected to home page.
Code - In app.py -
@login_required
@app.route('/home')
def home():
if current_user.Is_Authenticated:
return redirect(url_for('post1'))
else:
return render_template('post2.html')
@app.route('/upload', methods=['POST'])
def upload():
if current_user.Is_Authenticated:
user = current_user.Email
flag = True
else:
print("Current User is not Authenticated")
flag = False
if(flag):
if(request.method == "POST"):
if(request.files['myfile']):
myfile = request.files["myfile"]
sfname = os.path.join(os.getcwd(), 'static', str(secure_filename(myfile.filename)))
myfile.save(sfname)
return render_template('post.html')
else:
return redirect(url_for('home'))
When, I am testing the app, I found that, before authenticated, a user upload files with larger than 10MB, it shows "Site is not reachable". If it is small sized file, then flask redirected to home page, correctly.
how to solve this, why flask is not working when the uploading file size is larger than 10Mb, Thank you