title: java Spring boot get the file name in the controller when post request is sent via curl
body: <p>I am trying to upload a file from client to server the client uploads the file to the server using the curl command</p>
  
  <p><strong>client command:</strong></p>
  
  <pre><code>curl -X POST -T pom.xml http://localhost:8070/put --header "origmd5":"7AB4E6F0A4A2D3CBB200DB1677D99AD75"
  </code></pre>
  
  <p>Now in the controller i.e at the server side the code is as follows</p>
  
  <p><strong>server side:</strong></p>
  
  <pre><code>@PostMapping(value="readFile")
  public ResponseEntity&lt;?&gt; uploadfile(@RequestBody String filecontent) throws IllegalStateException, IOException {
  System.out.println(filecontent);//prints the content which is inside the file uploaded by client
    return null;
    }
  </code></pre>
  
  <p>1.Now the problem statement is how do we get the file name that has been sent by the client the contents of the file can be parsed in the request body but how to get the file name?</p>
  
  <pre><code> @RequestBody String filecontent
  </code></pre>
  
  <p>2.i am using string like above to parse request body (i.e content of file is stored in String) is this the correct way storing contents of file in string?</p>