servlets - java.io.FileNotFoundException: In Netbeans glashfish server -
i'm new java. tried save image through java servlet , ajax in netbeans. in netbeans tried same coding tomcat server working fine.if use glashfish it's throwing error. below coding.
servlet:
@override protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { part img = request.getpart("img"); string id = (string) request.getparameter("ids"); out.println(saveimage(img, "e:\\users\\xxxx\\desktop\\wine_shop\\build\\web\\images\\wines")); }
save image method:
private string saveimage(part img, string path) throws ioexception { file filesavedir = new file(path); if (!filesavedir.exists()) { filesavedir.mkdirs(); } system.out.println("upload file directory=" + filesavedir.getabsolutepath()); string filename = null; filename = extractfilename(img); img.write(path+ filename); return "1"; }
my error:
java.io.filenotfoundexception: e:\users\xxxx\appdata\roaming\netbeans\8.2\config\gf_4.1.1\domain1\generated\jsp\wine_shop\e:\users\xxxx\desktop\wine_shop\build\web\images\winesth.jpg (the filename, directory name, or volume label syntax incorrect)
help fix this..
Comments
Post a Comment