[wp-trac] [WordPress Trac] #21679: media_handle_upload does not provide a way to change the file's name
WordPress Trac
wp-trac at lists.automattic.com
Fri Aug 24 10:33:07 UTC 2012
#21679: media_handle_upload does not provide a way to change the file's name
-------------------------------------------------+-------------------------
Reporter: Willshouse | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
Component: Media | Review
Severity: normal | Version: 2.5
Keywords: has-patch needs-testing dev- | Resolution:
feedback |
-------------------------------------------------+-------------------------
Comment (by SergeyBiryukov):
[attachment:media.patch] looks reversed. Even with that corrected, it
would cause notices, since `wp_handle_upload()` result doesn't contain the
`name` key:
{{{
Notice: Undefined index: name in wp-admin/includes/media.php on line 215
Notice: Undefined index: extension in wp-admin/includes/media.php on line
221
}}}
[attachment:21679.patch] fixes the notices, but has one side effect.
Currently, if you upload "Picture.jpg" several times, the attachments will
have "Picture" title.
With the patch, the titles would be "Picture", "Picture1", "Picture2",
etc.
A workaround for the inability to change the title with
`wp_handle_upload_prefilter` would probably be to hook into
`add_attachment` and alter the title after the attachment has been
uploaded.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21679#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list