fi.write(file);
out.println("filepath"+file.getAbsolutePath());
System.out.println("above is actual paht and bellow are replace path");
String proPic = file.getAbsolutePath();
HPIUGS.setImageName(proPic);
System.out.println(HPIUGS.getImageName());
out.println("Uploaded Filename: " + fileName + "<br>");
out.println(filePath);
输出:
C:\Users\Peado Inffitech 5\Desktop\eclipse\jsp\UsersPanel\upload\uploadsPenguins.jpg
我改变输出为:
/jsp/UsersPanel/upload/uploadsPenguins.jpg
答案 0 :(得分:0)
String gotString = "C:\\Users\\Peado Inffitech 5\\Desktop\\eclipse\\jsp\\UsersPanel\\upload\\uploadsPenguins.jpg";
String newString = gotString.replace("C:\\Users\\Peado Inffitech 5\\Desktop\\eclipse", "").replace("\\", "/");
System.out.print(newString);
如果我没有错过你的观点,这对你有用。