title: How to limit file's size and mimetype on upload to S3
body: <p>On my application I save all user's images on Amazon S3.
  I'm realizing a web interface for uploading images to S3.</p>
  
  <p>On my nodejs backend I'm creating presigned post request:</p>
  
  <pre><code>const presignedPostParams = ({ userId }) =&gt; ({
    Bucket: bucket,
    Conditions: [
      ['starts-with', '$key', `user/${userId}/`],
    ],
    Expires: 60 * 5,
  });
  
    const request = await createPresignedPost(presignedPostParams({ userId }));
  </code></pre>
  
  <p>On my frontend I'm sending a form to S3 with presigned params.</p>
  
  <p>It works.</p>
  
  <p>But now I can upload any files, not only images. I want to limit file types to upload (mimetypes)? Of course, I can limit it by javascript code on front. By it is not reliable.</p>
  
  <p>Can I limit file mimetype while I'm creating presigned url?</p>
  
  <p>And the second question: can I manage the permission of uploaded file from presigned url? I want upload some public and some private files from one interface (maybe I can realize this with presigned url?)</p>