I ran my 3.1 upgrade yesterday thinking it’d be fairly uneventful coming from 3.0.5. However, I was disappointed to see all the sites on my network were serving corrupt images. Not theme images, mind you, jut the ones that were pushed up though the WP uploader. I soon found that all uploaded media had the same problem.
I got some pointers from a few threads on the wordpress.org forum. A discussion titled Media Library and pics in WPMU don’t work was particularly helpful.
This sort of thing generally means .htaccess issues, specifically the line below being goofed up somehow. (this example is for a subdirectory install and NOT for subdomain-style)
# uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
This was not the case, so then you’ll want to check httpd.conf to make sure your AllowOverride is set to All for the directory that the .htaccess file lives in.
I also went through the drill of turning off all plugins and switching to twenty ten theme just to be sure, but without any luck.
After digging a little deeper I found a bug report on TRAC. After applying a patch to ms-files.php everything is working great again.

The patch clears out the buffer before reading the file.
I don’t know if this will make it into the core, but it certainly helped in my case. This patch is not in 3.1.1.