title: Cannot Upload Files to existing bucket in s3 SDK PHP
body: <p>Trying to upload files using the PHP SDK of s3. Uploading the file to the existing Bucket, pops up the error.</p>
  
  <pre><code>&lt;?php
  error_reporting(-1);
  // Set plain text headers
  header("Content-type: text/plain; charset=utf-8");
  // Include the SDK
  require_once '../sdk.class.php';
  </code></pre>
  
  <p>//<em>%<strong></em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>*</strong>%*/
  // UPLOAD FILES TO S3</p>
  
  <pre><code>// Instantiate the AmazonS3 class
  $s3 = new AmazonS3();
  $s3-&gt;path_style = true;
  
  $bucket = 'photossss1.abc.com';
  
  $name = "picture.jpg" ;
  $response = $s3-&gt;create_object($bucket, 'picture2.jpg', array(
      'fileUpload' =&gt; 'picture.jpg'
  ));
  
  if($response-&gt;isOk()){
      echo " Done" ;
  } else {
      //var_dump($response);
      echo "error: create_object error.";
  }
  </code></pre>
  
  <p>What is the error in the above code..?</p>
  
  <p>Debug:
  print_r($response->body); 
  =></p>
  
  <pre><code>CFSimpleXML Object
  (
      [Code] =&gt; PermanentRedirect
      [Message] =&gt; The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
      [RequestId] =&gt; DACD5C54BC4BD82
      [Bucket] =&gt; photossss1.abc.com
      [HostId] =&gt; QUBlZEZKh0Ujzk6UyGG7LjC0vMCWDlOPszTZru/+OpWidBH84VXor1 
      [Endpoint] =&gt; photossss1.abc.com.s3.amazonaws.com
  )
  </code></pre>