UploadField fixes for use on the front-end

The good news is that UploadField basically works on the front-end, and only a few smallish fixes were needed to make it operate well.

They are included in this PR.  The first few commits have been pulled from 3.1.