Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8577463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:09:57+00:00 2026-06-11T20:09:57+00:00

I am using the following link for using the Google Cloud Storage : Google

  • 0

I am using the following link for using the Google Cloud Storage :

Google CLoud

I want to upload an object using insert function given in the above API.I am using PHP. The code i am using is as follows :

$StorageService = new Google_StorageService($client);
$objects = $StorageService->objects;
$gso = new Google_StorageObject();
$gso->setName('myobj');
$postbody = array(file_get_contents('buc.jpg'));
$resp = $objects->insert('mybucket', $gso, $postbody);

But i m getting Error as :

Fatal error: Uncaught exception ‘Google_ServiceException’ with message ‘Error calling POST https://www.googleapis.com/storage/v1beta1/b/mybucket/o: (400) Required’ in /home/www/public_html/abc/google-api-php-client/src/io/Google_REST.php on line 66

What am i doing wrong please help me out..

There is some problem with the way i am sending the parameters. Please if anyone knows help me..

There is an example here :

Example

But that is in Java Please help me to do the same thing in PHP. Please help me out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:09:58+00:00Added an answer on June 11, 2026 at 8:09 pm

    I figured out the answer. The code to be used is as follows :

    $objects = $StorageService->objects;
    $postbody = array('data' => file_get_contents('buc.jpg'));
    $gso = new Google_StorageObject();
    $gso->setName('mybuc');
    $resp = $objects->insert('mybucket', $gso ,$postbody);
    print_r($resp);
    

    and then it works ..
    I was not setting the parameter “data” in an array to be passed as a third parameter of the function. I Found out and it worked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using bitlyj snapshot jar to shorten URLs from the following link. http://code.google.com/p/bitlyj/downloads/list
I am following the link http://code.google.com/p/django-multilingual-model/ Basically i am trying to insert hindi characters
I'm using the following code to generate a random string: <?php function random_string( )
i am trying to run google map tutorial using following link http://mobiforge.com/developing/story/using-google-maps-android followed all
I put a Ajax link using the following code: echo chtml::ajaxLink('GO', 'http://localhost/index.php?r=user/delete', array('method'=>'POST')); But,
I am very new to the google cloud storage. I want to create folder
I am customizing UItextField for local currency symbol and comma, using following link :
I have created a listview using following tutorial link http://www.ezzylearning.com/tutorial.aspx?tid=1763429 Outcome of this is,
I'm using Fancybox 1.3.4 with ASP.NET MVC 3. I have following link : <a
I'm currently using the following code to append a X link to each element

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.