Skip to content

Commit

Permalink
Merge pull request #50 from qiniu/develop
Browse files Browse the repository at this point in the history
Release 6.1.3
  • Loading branch information
longshanksmo committed Oct 9, 2013
2 parents bf6c493 + 030dc5e commit a5e7634
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## CHANGE LOG

### v6.1.3

2013-10-09 issues [#50](https://github.com/qiniu/php-sdk/pull/50)

- 断点续上传使用mkfile
- 修订文档
- 消除测试用例并发问题

### v6.1.2

2013-09-24 issue [#40](https://github.com/qiniu/php-sdk/pull/40)
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ SDK源码地址:<https://github.com/qiniu/php-sdk/tags>
## 上传下载接口

<a name=upload></a>
###1. 文件上传
### 1. 文件上传

为了尽可能地改善终端用户的上传体验,七牛云存储首创了客户端直传功能。一般云存储的上传流程是:

Expand Down Expand Up @@ -283,7 +283,7 @@ SDK源码地址:<https://github.com/qiniu/php-sdk/tags>
//$baseUrl 就是您要访问资源的地址
$baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key);

其中<domain>是bucket所对应的域名。七牛云存储为每一个bucket提供一个默认域名。默认域名可以到[七牛云存储开发者平台](https://portal.qiniu.com/)中,空间设置的域名设置一节查询。用户也可以将自有的域名绑定到bucket上,通过自有域名访问七牛云存储。
其中\<domain\>是bucket所对应的域名。七牛云存储为每一个bucket提供一个默认域名。默认域名可以到[七牛云存储开发者平台](https://portal.qiniu.com/)中,空间设置的域名设置一节查询。用户也可以将自有的域名绑定到bucket上,通过自有域名访问七牛云存储。

**注意: key必须采用utf8编码,如使用非utf8编码访问七牛云存储将反馈错误**

Expand Down
15 changes: 8 additions & 7 deletions qiniu/resumable_io.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ function Qiniu_Rio_Mkblock($self, $host, $reader, $size) // => ($blkputRet, $err
return Qiniu_Client_CallWithForm($self, $url, $body, 'application/octet-stream');
}


function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra) // => ($putRet, $err)
{
$entry = $extra->Bucket . ':' . $key;
$url = $host . '/rs-mkfile/' . Qiniu_Encode($entry) . '/fsize/' . $fsize;

$url = $host . '/mkfile/' . $fsize;
if ($key !== null) {
$url .= '/key/' . Qiniu_Encode($key);
}
if (!empty($extra->MimeType)) {
$url .= '/mimeType/' . Qiniu_Encode($extra->MimeType);
}
Expand All @@ -74,7 +76,7 @@ function Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $extra) // => ($putRet, $e
}
$body = implode(',', $ctxs);

return Qiniu_Client_CallWithForm($self, $url, $body, 'text/plain');
return Qiniu_Client_CallWithForm($self, $url, $body, 'application/octet-stream');
}

// ----------------------------------------------------------
Expand Down Expand Up @@ -107,22 +109,21 @@ function Qiniu_Rio_Put($upToken, $key, $body, $fsize, $putExtra) // => ($putRet,
$self = new Qiniu_Rio_UploadClient($upToken);

$progresses = array();
$host = $QINIU_UP_HOST;
$uploaded = 0;
while ($uploaded < $fsize) {
if ($fsize < $uploaded + QINIU_RIO_BLOCK_SIZE) {
$bsize = $fsize - $uploaded;
} else {
$bsize = QINIU_RIO_BLOCK_SIZE;
}
list($blkputRet, $err) = Qiniu_Rio_Mkblock($self, $host, $body, $bsize);
list($blkputRet, $err) = Qiniu_Rio_Mkblock($self, $QINIU_UP_HOST, $body, $bsize);
$host = $blkputRet['host'];
$uploaded += $bsize;
$progresses []= $blkputRet;
}

$putExtra->Progresses = $progresses;
return Qiniu_Rio_Mkfile($self, $host, $key, $fsize, $putExtra);
return Qiniu_Rio_Mkfile($self, $QINIU_UP_HOST, $key, $fsize, $putExtra);
}

function Qiniu_Rio_PutFile($upToken, $key, $localFile, $putExtra) // => ($putRet, $err)
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

$tid = getenv("TRAVIS_JOB_NUMBER");
if (!empty($tid)) {
$pid = getmypid();
$tid = strstr($tid, ".");
$tid .= "." . $pid;
}

function initKeys() {
Expand Down

0 comments on commit a5e7634

Please sign in to comment.