Index: wp-admin/media.php
===================================================================
--- wp-admin/media.php	(revision 7828)
+++ wp-admin/media.php	(working copy)
@@ -9,14 +9,14 @@
 
 switch( $action ) :
 case 'editattachment' :
-	$errors = media_upload_form_handler();
 	$attachment_id = (int) $_POST['attachment_id'];
-
 	check_admin_referer('media-form');
 
 	if ( !current_user_can('edit_post', $attachment_id) )
 		wp_die ( __('You are not allowed to edit this attachment.') );
 
+	$errors = media_upload_form_handler();
+
 	if ( empty($errors) ) {
 		$location = 'media.php';
 		if ( $referer = wp_get_original_referer() ) {
