import java.io.InputStream;
// 获得请求文件名
String fileName = request.getParameter("fileName");
// 获取目标文件的绝对路径(硬盘路径)
String filePath = "WEB-INF/uploadFiles/" + fileName;
filePath = this.getServletContext().getRealPath(filePath);// 如:D:WorkSpaceseclipse2016demo_uploadAndDownloadWebContentWEB-INFuploadFiles
ootPath.png
// 读取文件
InputStream in = new FileInputStream(filePath);
import java.io.InputStream;
// 获得请求文件名
String fileName = request.getParameter("fileName");
// 目标文件的相对路径
String filePath = "WEB-INF/uploadFiles/" + fileName;
// 读取文件
InputStream in = this.getServletContext().getResourceAsStream("/" + filePath);