Jun-13-2021, 10:40 AM
Hello
I have manage to create a REST API Server that uplaod a file on reqeust.
my question is simple :
how can I aslo return a message on browser?
soemthing like "download should start now" and also download the file?
I have try this:
and it doesn't download anything
when I put the send_from_directory into the return - the file is downloding
how can i combine the 2? (if it's possiable)
Thanks ,
I have manage to create a REST API Server that uplaod a file on reqeust.
my question is simple :
how can I aslo return a message on browser?
soemthing like "download should start now" and also download the file?
I have try this:
@api.route("/test") def CreateFile(): StartTime = request.args.get('StartTime') print("Start Time is ", str(StartTime)) try: LogName = FilterLogFile(StartTime) except TypeError as e: print(e) return str(e) except ValueError as e: print(e) return str(e) else: send_from_directory(UPLOAD_DIRECTORY, "CutLogData1.txt", as_attachment=True) return "OK - download start", 200but he only print me the "OK - download start", 200
and it doesn't download anything
when I put the send_from_directory into the return - the file is downloding
how can i combine the 2? (if it's possiable)
Thanks ,