Refactor handling of uploaded file into its own function
Add nicer error pages