public function init_from_json($objects_json)
 {
     $objects_list = json_decode($objects_json, true);
     $this->bucket = $objects_list[self::BUCKET_TAG];
     $this->prefix = $objects_list[self::PREFIX_TAG];
     $this->commonPrefix = $objects_list[self::COMMON_PREFIXS];
     $this->keyMarker = isset($objects_list[self::KEY_MARKER]) ? $objects_list[self::KEY_MARKER] : '';
     $this->uploadIdMarker = isset($objects_list[self::UPLOADID_MARKER]) ? $objects_list[self::UPLOADID_MARKER] : '';
     $this->nextKeyMarker = isset($objects_list[self::NEXT_KEY_MARKER]) ? $objects_list[self::NEXT_KEY_MARKER] : '';
     $this->nextUploadIdMarker = isset($objects_list[self::NEXT_UPLOAD_ID_MARKER]) ? $objects_list[self::NEXT_UPLOAD_ID_MARKER] : '';
     $this->delimiter = isset($objects_list[self::DELEMITER_TAG]) ? $objects_list[self::DELEMITER_TAG] : '';
     foreach ($objects_list[self::UPLOAD_TAG] as $one_object) {
         $multipart = new MultipartUpload();
         $this->upload[] = $multipart->init_from_array($one_object);
     }
     return $this;
 }
예제 #2
0
 /**
  *Initiate Multipart Upload "Init Multipart Upload" in API
  * @param string $bucket_name  bucket's name to create
  * @param string $object_key object's key,
  * @param array,request_headers,request header needed in init mulitpart upload,can be empty
  * @return MultipartUpload on success
  * @exception see JSSError
  */
 public function init_multipart_upload($bucket_name, $object_key, $request_headers = array())
 {
     $path = "/{$bucket_name}/{$object_key}?uploads";
     $jss_response = $this->make_request_with_path_and_params_split("POST", $path, array(), $request_headers);
     $jss_response->check_response();
     $multipartUpload = new MultipartUpload();
     return $multipartUpload->init_from_json($jss_response->get_body());
 }