将附件上载到CouchDb
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将附件上载到CouchDb相关的知识,希望对你有一定的参考价值。
Here is how to upload an attachment to a CouchDb document using php and cURL.
/** * author: Stephane P. Pericat * date: 2010-03-08 */ <?php class Couch { static $url = "http://localhost:5984"; static function upload($path, $rev, $filepath, $filename, $content_type) { $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 ); return $process; } } $test = Couch::upload('/test/upload/', '1-a6eacb015eaedf5bcfb253430281bb65', '/var/www/test/', 'chrome.jpg', 'image/jpeg'); ?>
以上是关于将附件上载到CouchDb的主要内容,如果未能解决你的问题,请参考以下文章
python 使用Python将附件上载到Salesforce
python ServiceNow REST附件API示例Python示例使用/ now / attachment / file endpoint将文件作为附件发布(上载)到inc