[wp-hackers] Media reupload

Roman Ženka roman.zenka at gmail.com
Sat Jan 16 15:28:13 UTC 2010


Dear WP hackers,

I am working on an online art shop that utilizes WP media management. I am
allowing Wordpress to manage all media uploads, thumbnail creation, etc.

I need to be able to reupload an image, replacing it with an updated
version. I wrote a 'attachment_fields_to_edit' filter that hacks an
"Reupload" field into the Edit Media page.

I need to change the media.php to use enctype="multipart/form-data", so the
files get sent reasonably efficiently.

My question is - would it be okay to add this little change to media.php, so
I do not have to hack every WP update by hand?

Before:
<form method="post" action="<?php echo esc_url( remove_query_arg( 'message'
) ); ?>" class="media-upload-form" id="media-single-form">

After:
<form method="post" action="<?php echo esc_url( remove_query_arg( 'message'
) ); ********enctype="multipart/form-data"******* ?>"
class="media-upload-form" id="media-single-form">

It would allow plugins using 'attachment_fields_to_edit' to provide file
upload fields that would work efficiently.

What would you suggest? Ideally I could reuse WP's flash/html uploader, but
I do not think it is written to enable that. Also, I am already within a
form, and nested forms are forbidden in HTML.

Thank you for your advice,

--Roman


More information about the wp-hackers mailing list