dready92 / PHP-on-Couch

Data Access Library to access a CouchDB server with PHP.
http://dready.byethost31.com/index.php/display/view/192
GNU Lesser General Public License v3.0
246 stars 102 forks source link

How to add Multiple attachments? #35

Closed shiv-allva closed 11 years ago

shiv-allva commented 12 years ago

This is not an issue, but a question.

I'm using 'PHP On Couch' plugin for accessing couchDB through php. And i don't know how to add multiple attachments to a document

$client = new couchClient($couch_dsn,$couch_db); $doc = $client->getDoc('meantime');

$res1 = $client->storeAttachment($doc,'files/file1.html','text/html', 'file1.html'); $res2 = $client->storeAttachment($doc,'files/file2.html','text/html', 'file2.html');

Only one attachment is tied to document but not the second?

ClemensSahs commented 11 years ago

works fine for me...

$couchClient = new \PhpOnCouch_Client('http://127.0.0.1:5984/', 'test');
$couchClient->asCouchDocuments();
$doc = $couchClient->getDoc('documentIdInCouch');

$doc->storeAttachment(__FILE__,'text/php','test1.php');
$doc->storeAttachment(__FILE__,'text/php','test2.php');

var_dump($doc->getFields());

can close after this time