Esempio n. 1
0
 /**
  * Update a file
  *
  * @param   string       $path
  * @param   string       $contents
  * @param   mixed        $config   Config object or visibility setting
  * @return  array|bool
  */
 public function update($path, $contents, Config $config)
 {
     list($ret, $err) = Qiniu_RS_Put($this->getClient(), $this->bucket, $path, $contents, null);
     if ($err !== null) {
         return false;
     }
     $mimetype = Util::guessMimeType($path, $contents);
     return compact('mimetype', 'path');
 }
Esempio n. 2
0
 public function testPut()
 {
     $key = 'tmp/testPut' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     list($ret, $err) = Qiniu_RS_Put($this->client, $this->bucket, $key, 'hello world!', null);
     $this->assertNull($err);
     $this->assertArrayHasKey('hash', $ret);
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }