Fileupload master

File upload function based on Mark's master branch.