Пример #1
0
 public function appendObj($token, $bucket_name, $object_name, $upload_id, $next_marker, $data)
 {
     $Connection = isset($this->ceph_conn) ? $this->ceph_conn : $this->connectionCeph();
     $part_file_path = session('user_upload_path') . DIRECTORY_SEPARATOR . $object_name . '~' . DIRECTORY_SEPARATOR . '' . $next_marker;
     appendToFile($part_file_path, $data);
     if (getfilesize($part_file_path) > 5 * 1024 * 1024) {
         $opt['fileUpload'] = $part_file_path;
         $opt['partNumber'] = $next_marker;
         $opt['md5'] = md5_file($part_file_path);
         $res = $Connection->upload_part($bucket_name, $object_name . '~', $upload_id, $opt);
         if ($res->isOK()) {
             removeFile($part_file_path);
             $user = new UserService();
             $user->updateUserUploadMarker($token, $object_name, $next_marker + 1);
         } else {
             return false;
         }
     }
     return true;
 }