o.k. media.php is in wp-admin and not wp-content.
The relevant bit of code is:
27 if ( empty($errors) ) {
28 $location = 'media.php';
29 if ( $referer = wp_get_original_referer() ) {
30 if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) )
31 $location = $referer;
32 }
33 if ( false !== strpos($location, 'upload.php') ) {
34 $location = remove_query_arg('message', $location);
35 $location = add_query_arg('posted', $attachment_id, $location);
36 } elseif ( false !== strpos($location, 'media.php') ) {
37 $location = add_query_arg('message', 'updated', $location);
38 }
39 wp_redirect($location);
40 exit;
41 }
Given that it is referring media.php to wp-content instead of the true location wp-admin, it seems that the problem could possibly have something to do with $location call. If that is the case need to figure out where this is being defined, and if related to the problem why it is pointing to the different location.