Thanks :)
All working now, included code below for whoever runs into the same blunder.
(PHP) inline attachment dictionary.
/**
*
* This is used to add an inine attachment to a document.
*
* @param String $attachmentName
* @param String $attachmentPath
*/
public function attachment( $attachmentName, $attachmentPath )
{
$attachmentContent = trim(
file_get_contents( $attachmentPath ) );
$attachmentBase64Encoded =
base64_encode( $attachmentContent );
$this->_attachments = new
stdClass();
$this->_attachments->$attachmentName = new
stdClass();
$this->_attachments->$attachmentName->content_type =
"text/plain";
$this->_attachments->$attachmentName->data =
$attachmentBase64Encoded;
}
4Things
Multimedia and Communication | Property | Entertainment
Kwasi Owusu Gyasi - Agyei
cell (+27) (0) 76 466 4488
website www.4things.co.za
email [email protected]
skype kwasi.gyasiagyei
role Developer.Designer.Software Architect
On 21 Sep 2011, at 11:50 PM, Jens Alfke wrote:
>
> On Sep 21, 2011, at 1:46 PM, Kwasi Gyasi - Agyei wrote:
>
>> "_attachments":[
>> {"test":
>> {"content_type":"text\/plain",
>> "data":"aGVsbG8gd29ybGQ="
>> }
>> } ]
>
> _attachments is a dictionary, not an array. This should be:
>
> "_attachments”:{
> "test":
> {"content_type":"text\/plain",
> "data":"aGVsbG8gd29ybGQ="
> }
> }
>
> See <http://wiki.apache.org/couchdb/HTTP_Document_API#Inline_Attachments>
>
> —Jens