spring boot - Internal Server error -- Java.lang.RuntimeException:java.io.IOException: Missing initial multipart boundary, -
i trying upload picture file system. using spring boot , jetty server. getting internal server error -- java.lang.runtimeexception:java.io.ioexception: missing initial multipart boundary when trying upload picture. following piece of code
@requestmapping(value = "/setprofilepic", method = requestmethod.post) public datumresponse<identry> setprofilepic(@requestparam("file") multipartfile file, httpservletrequest request) { datumresponse<identry> response = new datumresponse<identry>(); if (file.isempty()) { response.setdata(new identry("file not uploaded")); return response; } try { // file , save somewhere byte[] bytes = file.getbytes(); path path = paths.get("/data/pic/" + "myfile" + ".jpeg"); files.write(path, bytes); response.setdata(new identry("you uploaded")); system.out.println("you uploaded the."); return response; } catch (ioexception e) { e.printstacktrace(); } return response; }
please me understand why error coming , can possible solution.
Comments
Post a Comment