Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feature: add param retry for form upload #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kougazhang wants to merge 1 commit into upyun:master
base: master
Choose a base branch
Loading
from kougazhang:feature/form-retry
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions src/Upyun/Api/Form.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,27 @@ public function upload($path, $stream, $params)
'timeout' => $this->config->timeout,
]);

$response = $client->request($method, $this->endpoint, array(
'multipart' => array(
array(
'name' => 'policy',
'contents' => $policy,
),
array(
'name' => 'authorization',
'contents' => $signature,
),
array(
'name' => 'file',
'contents' => $stream,
for ($i = 0; $i < $this->config->retry; $i++) {
$response = $client->request($method, $this->endpoint, array(
'multipart' => array(
array(
'name' => 'policy',
'contents' => $policy,
),
array(
'name' => 'authorization',
'contents' => $signature,
),
array(
'name' => 'file',
'contents' => $stream,
)
)
)
));
return $response->getStatusCode() === 200;
));
if ($response->getStatusCode() == 200) {
return true;
}
}
return false;
}
}
5 changes: 5 additions & 0 deletions src/Upyun/Config.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class Config
*/
public $sizeBoundary = 31457280;

/**
* @var int 支持 form 上传时重试
*/
public $retry = 1;

/**
* @var int 并行式断点续传的并发数
*/
Expand Down

AltStyle によって変換されたページ (->オリジナル) /