One feature of web applications is the ability to upload a file to an application. It is very common to see applications allow users to upload images for their avatar among other file types. This application shows how that feature can be implemented in Flask.
- File Upload
- Flask Framework
- Twitter Bootstrap for styling
- Python3 for programming
- Flask-WTF for form creation
To test the project, youcan clone this repo to your local machine by running the command below in your terminal:
$ git clone git@github.com:GitauHarrison/handling-file-uploads-in-flask.git
Create and activate your virtual environment before running the flask server:
$ mkvirtualenv file_upload # I am using virtualenvwrapper
Install used dependancies by running:
(file_upload)$ pip3 install -r requirements.txt
Run the application:
(file_upload)$ flask run
- File Upload App on Heroku
If you would like to see how the application can be built from scratch, here is an article you can refer to.