I have uploaded a file in java, and I am trying something like this to get the uploaded file name
private UploadedFile uploadedFile;
System.out.println("File name: " + uploadedFile.getName());
and it is printing the filename along with its path relative to Computer as:
File name: E:\Grievances Project\Feb 2012 data\22439-29-02-2012\22439-29-02-2012.xls
how can i get only the uploaded file name irrespective of the place from where it is being uploaded like :
File name: 22439-29-02-2012.xls
You might also look through the
Stringmethods for things likelastIndexOf("path separator")andsubstring(int,int), to handle it in a more generic way.