File upload

Added file upload code, this was not my code it was forked from somewhere... I don't remember where.