«Текущий запрос не является составным запросом» выдается ошибка, когда я хочу сохранить файл - PullRequest
0 голосов
/ 27 марта 2020

Контроллер

@GetMapping
public String upload(@RequestParam("file") MultipartFile file,@ModelAttribute("user")@Valid User user) throws IOException {

        Authentication loggedInUser = SecurityContextHolder.getContext().getAuthentication();
        String email = loggedInUser.getName();
        User currentUser = userR.findByEmail(email);
        byte[] image = file.getBytes();
        User imgObj = new User(image);
        userR.save(imgObj);

        return "trueupload";
    }

Шаблон

<form action="/trueupload" method="POST" enctype="multipart/form-data">
		<input type="file" name="file" >
		<input type="submit">
		</form>

Все это выбрасывает вышеуказанную ошибку. Помощь!

...