File upload v2 merge into master

Complete file field type merge into master.
Including some basic bugfixing and cleanups.