Upload a file using java web services #651
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
hey guys am stuck in this problem , am using angular 2 as front end and java web services(restful) as back end and am trying to figure out how to upload an image using ng2-file-upload and and save it in hard drive , so my code for angular is same as i the demo but am struggling for the code of jee back end web service method , please help and thanks in advance
hi,
Had the same issue myself, and got it to work via trial and error.
Quick and dirty code sample below. The important bit is the @RequestParam("file").
It isn't mentioned anywhere, AFAIK, that the param is "file",
anything else won't work.
This post method is called for each file, so it doesn't matter if there are multiple files.
Oliver
I dont think the request param is file.
Required CommonsMultipartFile parameter 'file' is not present
tried it with multipartfile as well.
@PostMapping("/avatarImage")
@Timed
public ResponseEntity avatarImage(@RequestParam("file") CommonsMultipartFile file) throws URISyntaxException {
i have a work around to upload the files as base64.
in fileuploader.class.js update the following.
Any plan to add the official support for 'base64Data' files?