added file upload fixes to template model and view