Skip to content

Instantly share code, notes, and snippets.

@team172011
Created November 29, 2019 15:38
Show Gist options
  • Save team172011/bc61db7b13bc1a19d0c9c9b5dec215ed to your computer and use it in GitHub Desktop.
Save team172011/bc61db7b13bc1a19d0c9c9b5dec215ed to your computer and use it in GitHub Desktop.
Fileupload with Spring
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@PostMapping(value= "/projects/{name}/upload", consumes = { "multipart/form-data" })
ResponseEntity<String> addConfigurationAsXml(@PathVariable String name, @RequestPart("file") MultipartFile upfile){
byte[] bytes = upfile.getBytes();
return new ResponseEntity<>("Done..", HttpStatus.OK)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment