#488 Added basic file upload handler plus few refactorings