Receive an image in Spring-mvc

0

I'm trying to get an image on my controller in Spring -mvc and I do not know what kind of data I should put

@Controller
@RequestMapping("/image")
    public @ResponseBody String RecibeImagen(String datos) {

The thing is, I do not know how to change the String data for an image. I have tried this, but I do not understand very well, this would serve:

// public String RecibeImagen(@RequestParam("file")MultipartFile image) 

I am sending the image from Javascript in the following way

function subirImagen(fileURL) {

                var options = new FileUploadOptions();
                options.fileKey = "imagen";
                options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);

                var ft = new FileTransfer();
                ft.upload(fileURL, encodeURI("http://localhost:8080/HelloSpringMVC/image"), uploadSuccess, uploadFail, options);
            }

All help is welcome, thanks:)

    
asked by Silvia 18.04.2018 в 20:07
source

0 answers