/ Published in: PHP
Here is how to upload an attachment to a CouchDb document using PHP and cURL.
Expand |
Embed | Plain Text
/** * author: Stephane P. Pericat * date: 2010-03-08 */ <?php class Couch { $ch = curl_init(); $fullpath = self::$url.$path.$filename.'?rev='.$rev; CURLOPT_URL => $fullpath, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'PUT', "Content-Type: ".$content_type, ), CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data ); curl_setopt_array($ch, $options); $process = curl_exec($ch); curl_close($ch); return $process; } } $test = Couch::upload('/test/upload/', '1-a6eacb015eaedf5bcfb253430281bb65', '/var/www/test/', 'chrome.jpg', 'image/jpeg'); ?>
You need to login to post a comment.
