title: how to limit uploaded filesize in tomcat servlet
body: <p>I need to set max filesize for uploaded files in my servlet running on tomcat. I tried multipart config which worked on jetty, but tomcat just ignored it. It means deployment on tomcat server caused even big files can be uploaded.
  My configuration:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;myServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;sk.test.MyServlet&lt;/servlet-class&gt;
      &lt;multipart-config&gt;
          &lt;max-file-size&gt;1048576&lt;/max-file-size&gt;
          &lt;max-request-size&gt;104857600&lt;/max-request-size&gt;
      &lt;/multipart-config&gt;
  &lt;/servlet&gt;
  </code></pre>
  
  <p>I already tried annotated configuration, which didnt work too. </p>
  
  <p>Using: Tomcat 7.0.54, Servlet 3.0  </p>
  
  <p>I will appreciate any help, thanks</p>