Pull in changes for file upload support

These are @prashtx's additions to @hampelm's file upload work.

/cc @hampelm