如何获取input type=file的路径
1个回答
展开全部
JSP取得<input type="file"> 文件路径方式如下:
1.用request.getParameter(String str)
<input type="file" name="fileName">
后台用String fileName=request.getParameter("fileName")获取,试试
2.直接获取服务器上的内容
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> list = upload.parseRequest(request);
1.用request.getParameter(String str)
<input type="file" name="fileName">
后台用String fileName=request.getParameter("fileName")获取,试试
2.直接获取服务器上的内容
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> list = upload.parseRequest(request);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询