[wp-hackers] Front end file handling
Alex King
lists at alexking.org
Wed Nov 14 15:54:24 UTC 2012
You may want to take a look at this ticket:
http://core.trac.wordpress.org/ticket/19629
Cheers,
--Alex
http://alexking.org | http://crowdfavorite.com
On Nov 14, 2012, at 5:00 AM, Tom Barrett <tcbarrett at gmail.com> wrote:
> This is the hook that is currently failing:
>
> add_action( 'post_post_update', 'tcb_snoop_post_submission', 10 );
> function tcb_snoop_post_submission( $postarr ){
> //
> http://www.example.com/wp-content/uploads/supplier-pics/ahgajhvbjhb345345/mypic1.png
> $picurl = $postarr['supplier_picture'];
>
> require_once(ABSPATH . 'wp-admin/includes/file.php');
> require_once(ABSPATH . 'wp-admin/includes/media.php');
> $attach_id = media_sideload_image( $picurl, $postarr['ID'] ); // silent
> fail
>
> update_post_meta( $postarr['ID'], 'supplier_picture', $attach_id );
> }
>
>
>
> On 14 November 2012 11:17, Kevinjohn Gallagher <
> kevinjohngallagher at hotmail.com> wrote:
>
>>
>>
>>
>> I'd have a look at some of the bbPress stuff.There was some front-end
>> signature/avatar plugins that did something similar (can't find the link I
>> was looking for - sorry)
>>
>>
>>
>>
>>> Date: Wed, 14 Nov 2012 10:33:13 +0000
>>> From: tcbarrett at gmail.com
>>> To: wp-hackers at lists.automattic.com
>>> Subject: [wp-hackers] Front end file handling
>>>
>>> The aim is to let users upload a picture, but without using /wp-admin/.
>>> They update a post they own.
>>>
>>> I already have the file in a subdirectory of uploads. The URL to the file
>>> is stored as a piece of post meta.I want to add the image to the media
>>> library, and attach it to the post being edited.
>>>
>>> The media sideload functions live in /wp-admin/includes/media.php and are
>>> not loaded on the front end. They in turn need files.php - however, just
>>> including those two files in a hook breaks things (silently on my set
>> up).
>>>
>>> So, before I start rummaging around more, I thought I'd ask! How to best
>>> sideload from the front end in the above scenario?
>>>
>>>
>>>
>>> --
>>> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
>>> http://twitter.com/tcbarrett
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> http://twitter.com/tcbarrett
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list