[wp-xmlrpc] New Media Object
David Weiss
dave at daveweiss.net
Mon Apr 13 23:34:43 GMT 2009
And my starting point for getting the file into $data is this:
<?php
// get contents of a file into a string
$filename = "path-to-file";
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
fclose($handle);
?>
I'll let you all know if it works or not.
On Mon, Apr 13, 2009 at 4:43 PM, Joseph Scott <joseph at josephscott.org>wrote:
>
> On Apr 13, 2009, at 3:21 PM, David Weiss wrote:
>
> Yeah, I saw that function at php.net, and the user feedback just makes
> what seems like a simple function call completely confusing.
>
> I'll monkey around with it a bit and see what I can accomplish. I was
> hoping to avoid a day or two of fiddling with this by just seeing if anyone
> has actually used this API and made it work using PHP.
>
>
>
> I can confirm that it does work with PHP :-)
>
> Using the IXR library that WordPress ships with you need to make sure that
> the field is correctly marked up as base64:
>
> $file_data = new IXR_Base64( $data );
>
> The IXR_Base64 class takes care of calling the base64_encode() function for
> you.
>
>
>
> BTW, I'm on a Mac. I totally made the switch. The only thing I use my PC
> for is IE7 testing, because I don't want to run Parallels or anything like
> that on my souped up MacBook Pro. I'll check out MarsEdit.
>
>
>
> --
> Joseph Scott
> joseph at josephscott.org
> http://josephscott.org/
>
>
>
>
>
> _______________________________________________
> wp-xmlrpc mailing list
> wp-xmlrpc at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-xmlrpc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-xmlrpc/attachments/20090413/45e9bf64/attachment.htm
More information about the wp-xmlrpc
mailing list