예제 #1
0
 private function uploadFile(Bucket $bucket)
 {
     print "Uploading hello world file to bucket: " . $bucket->getName() . PHP_EOL;
     $contents = "Hello world";
     $uploadFilename = "hello_world_" . time() . ".txt";
     $filepath = __DIR__ . '/upload_file.txt';
     file_put_contents($filepath, $contents);
     $uploadUrlResponse = $this->m_b2->getUploadUrl($bucket->getId());
     $b2File = $this->m_b2->uploadFile($uploadFilename, $filepath, $uploadUrlResponse);
     return $b2File;
 }