日期:2014-05-17  浏览次数:20951 次

文件上传一般都怎么做
用jsp实现,用一些已有的包吗?文件类型不限制,主要以图片,word 为主,给点提示呀,谢谢啦

------解决方案--------------------
我用smartupload这个jar包可以实现上传
------解决方案--------------------
HTML code

<%@ page language="java" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>文件上传</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
  </head>
  
  <body>
  <form action="UploadSuccess.jsp" method="post" enctype="multipart/form-data"> 
      请选择要上传的文件:<br>
      <input type="file" name="upfile"><br>
      备注:<input type="text" name="description">
      <input type="submit" value="上传" name="upload"><br>
  </form>
  </body>
</html>

------解决方案--------------------
不用包的话用输入输出流做吧?
------解决方案--------------------
Structs已经封装了文件上传类,可以网上找点资源研究下
------解决方案--------------------
smartupload,很简单很好很强大
------解决方案--------------------
common-fileupload,这个不错啊