title: Not able to upload object to google cloud storage using google API
body: <p>I am using the following link for using the Google Cloud Storage : </p>
  
  <p><a href="http://code.google.com/p/google-api-php-client/source/browse/trunk/src/contrib/Google_StorageService.php" rel="nofollow">Google CLoud</a></p>
  
  <p>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 : </p>
  
  <pre><code>$StorageService = new Google_StorageService($client);
  $objects = $StorageService-&gt;objects;
  $gso = new Google_StorageObject();
  $gso-&gt;setName('myobj');
  $postbody = array(file_get_contents('buc.jpg'));
  $resp = $objects-&gt;insert('mybucket', $gso, $postbody);
  </code></pre>
  
  <p>But i m getting Error as :</p>
  
  <p>Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error calling POST <a href="https://www.googleapis.com/storage/v1beta1/b/mybucket/o" rel="nofollow">https://www.googleapis.com/storage/v1beta1/b/mybucket/o</a>: (400) Required' in /home/www/public_html/abc/google-api-php-client/src/io/Google_REST.php on line 66</p>
  
  <p>What am i doing wrong please help me out..</p>
  
  <p>There is some problem with the way i am sending the parameters. Please if anyone knows help me.. </p>
  
  <p>There is an example here :</p>
  
  <p><a href="https://developers.google.com/storage/docs/json_api/v1/objects/insert" rel="nofollow">Example</a></p>
  
  <p>But that is in Java Please help me to do the same thing in PHP. Please help me out.</p>