Ich habe jsp Seite:Datei hochladen Spring MVC
<form method="get" action="/save" type="multipart/form-data">
File to upload: <input type="file" name="file"><br />
<input type="text" name="name">
<input type="submit" value="Upload" />
</form>
Wie kann ich hochladen Datei Spring MVC mit? Welchen Controller muss ich verwenden?
Ich versuche, etwas schreiben:
@RequestMapping(value ="/save", method = RequestMethod.GET)
public String uploadDo(@RequestParam("file") MultipartFile file,
@RequestParam ("name") String name) {
return "success";
}
Aber wie bekommen Daten aus der Datei, weiß ich nicht.
Hoffe, du wirst mir helfen.
und jetzt bekomme ich Fehler: HTTP Status 500 - Anfrage Verarbeitung fehlgeschlagen; verschachtelte Ausnahme ist org.springframework.web.multipart.MultipartException: Die aktuelle Anfrage ist keine Multipart-Anfrage –