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 "/var/www/dekiwiki/proxy/test/uploads/version.png" http://dekiwiki:5984/test01_attachmentx/Campaign02/version.png?rev=857507768 Just wondering if anybody has seen this before and could shed some light on why I'm getting this error. Appreciate your help. Cheers, Zoltan PHP code: <?php $url = " http://dekiwiki:5984/test01_attachmentx/Campaign02/version.png?rev=857507768 "; $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); curl_close($ch); fclose($fp); 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>, {<0.340.0>,crash_report, [[{pid,<0.340.0>}, {registered_name,[]}, {error_info, {error,badarg, [{erlang,list_to_binary,[undefined]}, {couch_httpd_db,db_attachment_req,4}, {couch_httpd_db,do_db_req,2}, {couch_httpd,handle_request,3}, {mochiweb_http,headers,4}, {proc_lib,init_p,5}]}}, {initial_call, {mochiweb_socket_server,acceptor_loop, [{<0.59.0>,#Port<0.144>,#Fun<mochiweb_http.1.62821608>}]}}, {ancestors,[couch_httpd,<0.54.0>,couch_server_sup,<0.1.0>]}, {messages,[]}, {links,[<0.59.0>,#Port<0.448>]}, {dictionary,[]}, {trap_exit,false}, {status,running}, {heap_size,2584}, {stack_size,23}, {reductions,1078}], []]}} [error] [<0.59.0>] {error_report,<0.22.0>, {<0.59.0>,std_error, {mochiweb_socket_server,235,{child_error,badarg}}}} =ERROR REPORT==== 24-Oct-2008::05:11:10 === {mochiweb_socket_server,235,{child_error,badarg}}