I'm trying to get the data to write the data contained in the file to the DB. But I'm having problems with loading the csv on the page and then transmitting it and starting reading in the relative function.The page in question is formed as follows:
<div class = "content">
<div class = "container">
<div class = "main">
<h1> <strong> LOADING RESULTS </strong> </h1> <br/>
<div class = "round">
<form name = "controlEsits" action = "controlEsits" method = "get" enctype = "multipart / form-data">
<fieldset>
<legend> UPLOAD RESULTS FROM CSV </legend> <br/>
<strong> Academic Year </strong> <input type = "text" id = "aa" name = "Academic Year" value = "2020"> <br/>
<strong> Session </strong> <input type = "text" id = "session" name = "Session" value = "Winter"> <br/>
<strong> Test Type </strong> <input type = "text" id = "Test Type" name = "Test Type" value = "English"> <br/>
<strong> Results File </strong> <input type = "file" id = "file" name = "FileN" accept = "results / csv"> <br/> <br/>
<input class = "btn" type = "submit" value = "Upload Results from File" id = "btncheck" formaction = "/ insertionDBEsiti"> <br/> <br/>
<font color = "red"> <b> {{warning}} </b> </font>
</div>
</form>
</div>
</div>
</div>
{% include 'footer.html'%}
but i believe the problem may be in the part of code that gets the file:
@app.route('/inserimentoDBEsiti', methods=['POST', 'GET'])
def inserimentoDBEsiti():
aa = request.form.get('aa')
session = request.form.get('Session')
typeP = request.form.get('Test Type')
file = request.files["fileN"]
app.config["result"] = "../temp/"
file.save(os.path.join(app.config["result"], file.filename))
fileLocation = (os.path.join(app.config["result"], file.filename))
what am I doing wrong?