[wp-hackers] Uploading image attachments from the front-end
Dion Hulse (dd32)
wordpress at dd32.id.au
Thu Nov 12 20:40:07 UTC 2009
On Fri, 13 Nov 2009 05:28:54 +1100, Matthew Gerring <mgerring at emrl.com>
> I figured that out- media_sideload_image() handles the upload and
> creates a fake $_FILES-like array from a remote URL. You can pass a
> regular $_FILES array to media_handle_sideload() along with the post
> ID and it handles all of the attachment, meta, mimetype, thumbnail
> generation, and etc.
> I had to require /wp-admin/includes/admin.php to have access to all of
> the functions I needed- is this the best way to do it?
Unfortunately, Yes. As the media management functions are held within.
You might get away with just using wp-admin/includes/media.php and
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the wp-hackers