--------------------------------------------------- ***FileSelect.jsp <%@ page contentType="text/html;charset = EUC-KR" %>
user

title

file



------------------------------------------------- ***ViewPage.jsp <%@page contentType="text/html;charset=euc-kr" %> <%@page import="com.oreilly.servlet.MultipartRequest, com.oreilly.servlet.multipart.DefaultFileRenamePolicy, java.util.*, java.io.*" %> <% String realFolder=""; String saveFolder="filestorage"; String encType="euc-kr"; int maxSize=5*1024*1024; ServletContext scontext=getServletContext(); realFolder=scontext.getRealPath(saveFolder); //out.println("the realpath is:"+realFolder+"
"); try { MultipartRequest multi=null; multi=new MultipartRequest(request,realFolder,maxSize,encType,new DefaultFileRenamePolicy());///////////realFolder Enumeration params=multi.getParameterNames(); while(params.hasMoreElements()){ String name=(String)params.nextElement(); String value=multi.getParameter(name); out.println(name+"="+value+"
"); } Enumeration files=multi.getFileNames(); while(files.hasMoreElements()){ String name=(String)files.nextElement(); String filename=multi.getFilesystemName(name); String original=multi.getOriginalFileName(name); String type=multi.getContentType(name); File f=multi.getFile(name); out.println("파라메터 이름:"+name+"
"); //out.println("실제파일 이름:"+original+"
"); //교재원본 out.println("실제파일 이름: " +original+"
"); out.println("저장된 파일 이름:" +filename+"
"); out.println("파일타입:"+type+"
"); if(f!=null){ out.println("크기:"+f.length()); out.println("
"); } } }catch(IOException ioe){ System.out.println(ioe); }catch(Exception ex){ System.out.println(ex); } %> jsp스터디 2004 12 21 소스상세보기 http://www.6VJ.com/jsp/jsp1221.txt 다운받기 http://www.6VJ.com/jsp/cos-27May2002.zip