I have an endpoint that takes in a csv file given by the user, the function then performs some analysis on it, and the user should then have the report downloaded onto their system.
the code looks similar to this currently:
function uploadFile(file) {
var form = new FormData();
form.append('file', file);
var request = new XMLHttpRequest();
request.open('POST', '/upload');
request.send(form);
}
@app.route("/upload", methods=["POST"])
def endpoint_function():
file = flask.request.files["file"]
analysis_function(pd.read_csv(file)) # Outputs csv to 'filepath'
return flask.send_file(filepath, as_attachment=True)
When the function is triggered from the frontend, it creates the csv, but does not download it to the users system.
I have checked that the report csv is being correctly placed at the filepath.