BLOCKER: Issue 487

Note that this PR touches all code that deals with files and is ready for review.
Perhaps but that's what the DB and the rest of the code expects.