title: Restricting file types on amazon s3 bucket with a policy
body: <p>I'm trying to set up so the only file types the bucket can hold would be png, jpeg, and gif images. I'm trying to put in a bucket policy like this </p>
  
  <pre><code>{
      "conditions": [
          {"bucket": "bucketname"},
          ["starts-with", "$Content-Type", "image/jpeg"],
          ["starts-with", "$Content-Type", "image/png"],
          ["starts-with", "$Content-Type", "image/gif"],
          ["content-length-range", 0, 10485760]
      ]
  }
  </code></pre>
  
  <p>Then I'm also trying to limit the size but when I try to update my policy I get the error "Invalid policy element - conditions" </p>
  
  <p>I tried using the answer from here - <a href="https://stackoverflow.com/questions/13390343/s3-direct-upload-restricting-file-size-and-type">s3 direct upload restricting file size and type</a> so that's where I made my code from but I'm not sure the correct approach to do this since my policy isn't even being accepted by amazon.  </p>