title: How to change the maximum size of the file uploaded Java Post
body: <p>I take back the program of a colleague.</p>
  
  <p>He did the method (This program allows to upload a file on a server):</p>
  
  <pre><code>protected String uploadFile(File inputFile, String uuidFile) throws IOException,
          ClientProtocolException {
      HttpPost post = new HttpPost(new StringBuilder()
              .append("http://xxxxxxxxxxxxx/FileServlet/").append("/uploadFile")
              .toString());
      post.addHeader("UuidFile", uuidFile);
  
      MultipartEntityBuilder builder = MultipartEntityBuilder.create();
      builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
      builder.addPart("file", new FileBody(inputFile));
      HttpEntity httpEntity = builder.build();
  
      post.setEntity(httpEntity);
  
      CloseableHttpClient client = HttpClients.createDefault();
      HttpResponse response = null;
      try {
          response = client.execute(post);
  
          if (response.getStatusLine().getStatusCode() == 200) {
              Pattern p = Pattern.compile("File uploaded into (.*)&lt;/h2&gt;");
              String messageErreur = IOUtils.toString(response.getEntity().getContent());
              System.out.println(messageErreur);
              Matcher m = p.matcher(messageErreur);
              if (m.find()) {
                  return m.group(1);
              }
          } else {
              throw new RuntimeException(response.getStatusLine().getStatusCode() + ": " + new String(IOUtils.toByteArray(response.getEntity().getContent())));
          }
          return null;
      } finally {
          client.close();
      }
  }
  </code></pre>
  
  <p>The error in the console is</p>
  
  <blockquote>
    <p>There was an error: the request was rejected because its size
    (68142301) exceeds the configured maximum (52428800)</p>
  </blockquote>
  
  <p>However I don't know how to augment the maximum size of the file uploaded...</p>
  
  <p>Do you have an idea ?</p>
  
  <p>Thanks,
  Arnaud</p>