incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zoltan Klinger" <>
Subject Errors when adding attachment to document
Date Fri, 24 Oct 2008 05:34:36 GMT
Hi there,
I am trying to add an attachment to an existing document by sending a PUT
from a PHP script using curl module. The php code fails and a crash report
is being generated by couchdb. CouchDB version is 0.9.0a706847-incubating
from trunk.

Adding an attachment from the command line such as this works:
curl -i -X PUT -H 'Content-Type: image/png' -T

Just wondering if anybody has seen this before and could shed some light on
why I'm getting this error.

Appreciate your help.

PHP code:

$url = "
$localfile = "/var/www/dekiwiki/proxy/test/uploads/version.png";

$fp = fopen ($localfile, "r");
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));

$http_result = curl_exec($ch);
$error = curl_error($ch);
$http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE);


print "RESULT Http CODE:" . $http_code;
print "<br /><br />$http_result";
if ($error) {
   print "<br /><br />$error";


couchDB crash report:
[error] [<0.340.0>] {error_report,<0.22.0>,
[error] [<0.59.0>] {error_report,<0.22.0>,

=ERROR REPORT==== 24-Oct-2008::05:11:10 ===

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message