title: PUT file to S3 with presigned URL
body: <p>I've been playing with Amazon S3 presigned URLs all night attempting to PUT a file.  I generate the presigned URL in java code.</p>
  
  <pre><code>    AWSCredentials credentials = new BasicAWSCredentials( accessKey, secretKey );
      client = new AmazonS3Client( credentials );
      GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest( bucketName, "myfilename", HttpMethod.PUT);
      request.setExpiration( new Date( System.currentTimeMillis() + (120 * 60 * 1000) ));
      return client.generatePresignedUrl( request ).toString();
  </code></pre>
  
  <p>I then want to use the generated, presigned URL to PUT a file using curl.</p>
  
  <pre><code>curl -v -H "content-type:image/jpg" -T mypicture.jpg https://mybucket.s3.amazonaws.com/myfilename?Expires=1334126943&amp;AWSAccessKeyId=&lt;accessKey&gt;&amp;Signature=&lt;generatedSignature&gt;
  </code></pre>
  
  <p>I assumed that, like a GET, this would work on a bucket which is not public (that's the point of presigned, right?)  Well, I got access denied on every attempt.  Finally out of frustration I changed the permission of the bucket to allow EVERYONE to write.  Of course, then the presigned URL worked.  I quickly removed the EVERYONE permission from the bucket.  Now, I don't have permission to delete the item that was uploaded into my bucket by my own self-pre-signed URL.  I <a href="http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html" rel="noreferrer">see now</a> that I probably should have put a x-amz-acl header on what I uploaded.  I suspect I'll create several more undelete-able objects before I get that right.</p>
  
  <p>This leads to a few questions:</p>
  
  <ul>
  <li>How can I upload with curl using PUT and a generated presigned URL?</li>
  <li>How can I delete the uploaded file and the bucket I created to test it with?</li>
  </ul>
  
  <p>The end goal is that a mobile phone will use this presigned URL to PUT images.  I'm trying to get it going in curl as a proof of concept.</p>
  
  <p><strong>Update:</strong> I asked a question on the <a href="https://forums.aws.amazon.com/thread.jspa?threadID=91800" rel="noreferrer">amazon forums</a>. If an answer is provided there I'll put it as an answer here.</p>