Fully working version of file upload

Fixes issues #47