question: @ PostMapping ( consumes = "!multipart/form-data" ) public ResponseEntity < FileInfo > uploadFile ( HttpServletRequest request , @ RequestParam ( required = false ) String name ) { try { String contentLength = request . getHeader ( "Content-Length" ) ; long size = 0 ; try { size = Long . valueOf ( contentLength ) ; } catch ( NumberFormatException ignored ) { } FileDescriptor fd = createFileDescriptor ( name , size ) ; ServletInputStream is = request . getInputStream ( ) ; uploadToMiddleware ( is , fd ) ; saveFileDescriptor ( fd ) ; return createFileInfoResponseEntity ( request , fd ) ; } catch ( Exception e ) { log . error ( "File upload failed" , e ) ; throw new RestAPIException ( "File upload failed" , "File upload failed" , HttpStatus . INTERNAL_SERVER_ERROR ) ; } }
target:  Method for simple file upload. File contents are placed in the request body. Optional file name parameter is passed as a query param.