Fix to switch mimetype if the new file has a different mimetype.

Shouldn't this be (and also in the ingest case) be setting mimetype based on the file? Also the mimetype setting could likely be more DRY.