How to Check if file or folder exist in JSP or Java
<%
String path = "";
path = "D:\Folder\Data\2012\feb\Pan\PDml\001543\SomeFile.pdf";
File file=new File(path);
boolean exists = file.exists();
if (!exists) {
out.println("File not Available for Download");
}else{ // It returns true if File or directory exists
%>
<a href=''><font class='blueList'>Download File</font> </a>
<% }
%>
0 comments :
Feel free to leave comment if you like above widget, have any questions or just say Hi! :)