给我发邮件,我给你一篇我在《开放系统世界》发表的关于文件上传的文章![email protected]

解决方案 »

  1.   

    <%@ page contentType="text/html; charset=gb2312" buffer="1" autoFlush="true"%><%@ page import="com.jspsmart.upload.*" %>
    <body><%
    SmartUpload upload = new SmartUpload();
    upload.initialize(pageContext);
    upload.upload();
    for (int i=0;i<upload.getFiles().getCount();i++){
    com.jspsmart.upload.File newFile = upload.getFiles().getFile(i); if (!newFile.isMissing()) { newFile.saveAs("d:/websrc/upload/" + newFile.getFileName());//修改你的存储路径
    out.println("FieldName = " + newFile.getFieldName() + "<BR>");
    out.println("Size = " + newFile.getSize() + "<BR>");
    out.println("FileName = " + newFile.getFileName() + "<BR>");
    out.println("FileExt = " + newFile.getFileExt() + "<BR>");
    out.println("FilePathName = " + newFile.getFilePathName() + "<BR>");
    out.println("ContentType = " + newFile.getContentType() + "<BR>");
    out.println("ContentDisp = " + newFile.getContentDisp() + "<BR>");
    out.println("TypeMIME = " + newFile.getTypeMIME() + "<BR>");
    out.println("SubTypeMIME = " + newFile.getSubTypeMIME() + "<BR>"); } }
    %>
    </body>