Fix minor upload bugs. Fixes #337

Guessing at a few of these since I don't have a file to test, but these
all seem reasonable. If any errors re-occur, please re-open.