code formatting fixes in media.php
media: don't call get_post() if --post_id isn't even passed
media: make the temp file have the proper extension from the start