rs_utils.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. require_once("rs.php");
  3. require_once("io.php");
  4. require_once("resumable_io.php");
  5. function Qiniu_RS_Put($self, $bucket, $key, $body, $putExtra) // => ($putRet, $err)
  6. {
  7. $putPolicy = new Qiniu_RS_PutPolicy("$bucket:$key");
  8. $upToken = $putPolicy->Token($self->Mac);
  9. return Qiniu_Put($upToken, $key, $body, $putExtra);
  10. }
  11. function Qiniu_RS_PutFile($self, $bucket, $key, $localFile, $putExtra) // => ($putRet, $err)
  12. {
  13. $putPolicy = new Qiniu_RS_PutPolicy("$bucket:$key");
  14. $upToken = $putPolicy->Token($self->Mac);
  15. return Qiniu_PutFile($upToken, $key, $localFile, $putExtra);
  16. }
  17. function Qiniu_RS_Rput($self, $bucket, $key, $body, $fsize, $putExtra) // => ($putRet, $err)
  18. {
  19. $putPolicy = new Qiniu_RS_PutPolicy("$bucket:$key");
  20. $upToken = $putPolicy->Token($self->Mac);
  21. if ($putExtra == null) {
  22. $putExtra = new Qiniu_Rio_PutExtra($bucket);
  23. } else {
  24. $putExtra->Bucket = $bucket;
  25. }
  26. return Qiniu_Rio_Put($upToken, $key, $body, $fsize, $putExtra);
  27. }
  28. function Qiniu_RS_RputFile($self, $bucket, $key, $localFile, $putExtra) // => ($putRet, $err)
  29. {
  30. $putPolicy = new Qiniu_RS_PutPolicy("$bucket:$key");
  31. $upToken = $putPolicy->Token($self->Mac);
  32. if ($putExtra == null) {
  33. $putExtra = new Qiniu_Rio_PutExtra($bucket);
  34. } else {
  35. $putExtra->Bucket = $bucket;
  36. }
  37. return Qiniu_Rio_PutFile($upToken, $key, $localFile, $putExtra);
  38. }