Some suggestion about putting a pdf file into CouchDB from php. Hope to be useful.

// url to CouchDB server
$url_path_str = 'http://address-of-my-couchdb-server:5984/pdfdb/MYCODE/MYFILENAME.pdf';

// path to the pdf file to insert into CouchDB database "pdfdb"
$file_path_str = '/path to my file.pdf';

// header - please note that "Content-Type" is NOT "application/json" like used in other POST/GET calls with JSON data
$header = array(
"Content-type: application/pdf",
"Cache-Control: no-cache",
"Pragma: no-cache"
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url_path_str);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

$fh_res = fopen($file_path_str, 'r');
$file_data_str = fread($fh_res, filesize($file_path_str));
rewind($fh_res);

curl_setopt($ch, CURLOPT_INFILE, $fh_res);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file_path_str));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$curl_response_res = curl_exec ($ch);
// the answer is similar to {"ok":true,"id":"MYCODE","rev":"3-6e8cb7a70206c31a8f0dab27b3b25353"}

curl_close($ch);

fclose($fh_res);

// Warning : CouchDB requires that last document revision must be provided during document update