title: Amazon S3 creating unique keys for every object
body: <p>My app users upload their files to one bucket. How can I ensure that each object in my S3 bucket has a unique key to prevent objects from being overwritten?</p>
  
  <p>At the moment I'm encrypting filenames with a random string in my php script before sending the file to S3. </p>
  
  <p>For the sake of the discussion let's suppose that the uploader finds a way to manipulate the filename on upload. He wants to replace all the images on my site with a picture of a <a href="http://cdn1.iconfinder.com/data/icons/fruits/512/Banana.png" rel="noreferrer">banana</a>. What is a good way to prevent overwriting files in S3 if encryption fails?</p>
  
  <p>Edit: I don't think versioning will work because I can't specify a version id in an image URL when displaying images from my bucket.</p>