Fix some bugs with file uploads.