Media file metadata rewrite.

Also fixes media upload form not being submitted.