0
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
'replace(「\\」,「/」)'。 – Satya
爲什麼要從文件路徑中刪除一些文件? – Satya
,但先生刪除部分路徑是C:\ Users \ Peado Inffitech 5 \ Desktop \ eclipse \如何更改 –