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);

Output :

C:\Users\Peado Inffitech 5\Desktop\eclipse\jsp\UsersPanel\upload\uploadsPenguins.jpg

where I change to get output as:

/jsp/UsersPanel/upload/uploadsPenguins.jpg
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555

1 Answers1

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);

This should work for you if I am not missing out your point horribly.

Helios
  • 851
  • 2
  • 7
  • 22