title: Java Spring max. size limit for upload
body: <p>I tried to upload files to my controller.</p>
  
  <p>This is the upper part pf my controller. It works till i reach i maximum request size of +- 2MB</p>
  
  <pre><code>&gt; @RequestMapping(value = {"/runlocalfiles"}, method =
  &gt; RequestMethod.POST, produces = "application/json")
  &gt;     @ResponseBody
  &gt;     @CrossOrigin(origins = "http://localhost:4200")
  &gt;     public ResponseEntity run( HttpServletRequest request) {
  &gt;         String jsonBase64Files = request.getParameter("base64files");
  &gt;         String jsonChecks = request.getParameter("checks");
  </code></pre>
  
  <p>Error message in browser:</p>
  
  <pre><code>&gt; Failed to load http://localhost:5001/runlocalfiles: No
  &gt; 'Access-Control-Allow-Origin' header is present on the requested
  &gt; resource. Origin 'http://localhost:4200' is therefore not allowed
  &gt; access. The response had HTTP status code 500.
  </code></pre>
  
  <p>Error in Java console:</p>
  
  <pre><code>&gt; java.lang.IllegalStateException: The multi-part request contained
  &gt; parameter data (excluding uploaded files) that exceeded the limit for
  &gt; maxPostSize set on the associated connector   at
  &gt; org.apache.catalina.connector.Request.parseParts(Request.java:2893)
  &gt; ~[tomcat-embed-core-8.5.20.jar:8.5.20]...
  </code></pre>
  
  <p>I have tried to increase the upload size by adding new lines to the application.properties. Also tried to change -1 to e.g. 100MB</p>
  
  <pre><code>&gt; spring.servlet.multipart.max-file-size= -1
  &gt; spring.servlet.multipart.max-request-size= -1
  &gt; spring.http.multipart.max-file-size = -1
  &gt; spring.http.multipart.max-request-size= -1
  </code></pre>
  
  <p>Any help is apriciated.</p>