Skip to content

Add file upload controller#16

Open
robjwilkins wants to merge 1 commit intomainfrom
add/file_upload
Open

Add file upload controller#16
robjwilkins wants to merge 1 commit intomainfrom
add/file_upload

Conversation

@robjwilkins
Copy link
Owner

Adds a controller which uses spring to handle to upload of files to the backend file system

Adds a controller which uses spring to handle to upload of files to the backend file system
@ResponseStatus(CREATED)
public String uploadFile(@RequestParam("file") MultipartFile file) {
var fileName = "build/tmp/" + file.getOriginalFilename();
try (var stream = new BufferedOutputStream(new FileOutputStream(fileName))){

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression

This path depends on a [user-provided value](1). This path depends on a [user-provided value](2).
} catch (IOException e) {
throw new RuntimeException(e);
}
Assert.isTrue(new File(fileName).exists(), "File was uploaded but exists != true");

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression

This path depends on a [user-provided value](1). This path depends on a [user-provided value](2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant