1

I'm trying to build a website that takes two files, does some operation on them to create a new 3rd file, and then sends the user an email link to the 3rd file.

Currently, I'm having trouble just getting the file to be upload-able. I have an HTML file with a nice UI using HTML's file input, but im not sure how to get that file back to python so I can process it.

Currently, my code is the most basic it can be, and I can't figure out what to do from here...

app = Flask(__name__)

@app.route('/', methods = ['GET', 'POST'])
def main_page():
    return render_template('website2.html')

if __name__ == '__main__':
    app.run()

and website2 is a website with an uploader that ideally can pass the uploaded file to a python script somewhere.

  • what have you tried with regards to uploading a file? you can check the documentation : https://flask.palletsprojects.com/en/1.0.x/patterns/fileuploads/ – NemoMeMeliorEst Jul 15 '19 at 13:00
  • Create a new endpoint where you can POST a file. From there on use something like Celery to perform a long running task. You can then use `smtplib` or whatever wrapper you find to send the mail – Zun Jul 15 '19 at 13:03

0 Answers0