I recently upgraded one of my WordPress websites to version 3.4.1. As soon as I did this I started experiencing issues with my media library.
Whenever I uploaded an image to the library I would be hit with a 404 error. I also got the same when I tried inserting an image into a post.
I searched the net extensively and tried many possible fixes but none of them worked. I tried altering my .htacces file (http://wordpress.org/support/topic/file-upload-link-error-404), I tried re uploading my wp-admin and wp-includes folders. I made sure my permissions were correct for the uploads folder and also the wp-content folder. I switched to the WordPress TwentyEleven theme but still the same issue was there. I even created a new site on the same host and was experiencing the same issue so decided it was something to do with my host.
I contacted my hosting company and explained the problem to them and with a couple minutes they had rectified the issue. Apparently the mod_security module was causing the conflict. They disabled it and just like that my site was working again.
A lot of the blog posts I found while searching for this had said that it was something to do with mod_security but none of the things I added to the .htaccess file seemed to be effective.
I hope this helps someone having the same I had.