Bill Erickson did a post about about this a few weeks ago: http://www.billerickson.net/wordpress-add-custom-fields-media-gallery/