I am passing an image from a webpage using AJAX request. The image is passed as a Data URI to a Java function as shown below.
public Result upload() {
String dataUri = request().body().asText();
System.out.println(dataUri);
File file = dataUri;
return ok("File uploaded");
}
The problem I am having is I think I need to convert the data URI to a file object in order to pass it into "File file = ". And if I can do that, then the image will be uploaded to the server. Any takers?