title: Amazon S3 images not uploading correctly
body: <p>I'm currently working on coding up a back end page for my site to allow admins to indirectly edit database entries and upload photos. I'm using Amazon S3 to host images to allow them to load faster, so when I upload images I have to first upload them to the server and then from there send them to the Amazon server. The images are correctly being uploaded to the server, but they aren't getting to Amazon's servers correctly. When I try to access the Amazon copy it seems to not exist. Here is the code I am using to upload images:</p>
  
  <pre><code>//Set up image validator
  $upload = new Zend_File_Transfer();
  $upload-&gt;addValidator('ImageSize', false, array('minwidth'  =&gt; 100,
                                                    'maxwidth'  =&gt; 1000,
                                                    'minheight' =&gt; 100,
                                                    'maxheight' =&gt; 1000), 'image')
         -&gt;addValidator('Extension', false, 'jpg')
         -&gt;addValidator('Count', false, array('min'=&gt;0, 'max'=&gt;2));
  
  //Set up Amazon class
  $s3 = new Zend_Service_Amazon_S3($my_aws_key, $my_aws_secret_key);
  
  if($upload-&gt;isUploaded('image')){ //Pic was uploaded
      if($upload-&gt;isValid('image')){ //Pic is valid
          echo "Pic provided is valid.";          
          $upload-&gt;addFilter('Rename',array('target'=&gt;BASE_PATH . "/public_html/items/{$item_id}_nsa.jpg",'overwrite'=&gt;true));
          $upload-&gt;receive();
          $pic = BASE_PATH . "/public_html/items/{$item_id}_nsa.jpg";
          try{
              $s3-&gt;putObject("media.completeset.com/images/items/{$item_id}_nsa.jpg", $pic,
                                          array(Zend_Service_Amazon_S3::S3_ACL_HEADER =&gt; Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ,
                                                Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER =&gt; "image/jpeg"));
              echo "Pic is uploaded.";
          }
          catch(Exception $e){
              echo "Exception: ".$e-&gt;getMessage();
          }
      }
      else{
          echo "Pic is invalid.";
      }
  }
  else{
      echo "Pic isn't uploaded";
  } 
  </code></pre>
  
  <p>And examples of my error. <a href="http://completeset.us/items/zFi9VokVlL_nsa.jpg" rel="nofollow">The local working copy</a> and <a href="http://cdn.completeset.com/items/zFi9VokVlL_nsa.jpg" rel="nofollow">the Amazon copy.</a> I've never worked with Amazon before so I have no idea what the problem is, how to figure out what it is, or how to solve it. Any help on any of those 3 points would be greatly appreciated.</p>