My patch only fixes the upload via repositories and one regression in uploadlib, the uploadlib is deprecated since Moodle 2.0, but it should still work fine.
This is not a final solution of course, somebody will have to spend a lot more time on cleanup of upload lib and virus handling, I did as few changes as possible to get something ready for integration into 2.1.x.
This patch does not address the compatibility with on-access virus scanner, in fact I had to turn it off in my computer completely when writing this.
We talked about this last week ... do you want to make some notes here?