2
回答
apache上传包类使用错误
终于搞明白,存储TCO原来是这样算的>>>   
filePath=request.getRealPath("RMS"); 
	 			  response.setContentType("text/plain");
	 			   //向客户端发送响应正文
	 			  PrintWriter outNet = response.getWriter();
	 			  DiskFileItemFactory factory = new DiskFileItemFactory();
	 			  factory.setSizeThreshold(4*1024);
	 			 //设置临时目录
	 			  //factory.setRepository(new File(tempFilePath));
	 			  //创建一个文件上传处理器
	 			  ServletFileUpload upload = new ServletFileUpload(factory);
	 			  //设置允许上传的文件的最大尺寸,此处为4M
	 			  upload.setSizeMax(4*1024*1024);
	 			  List items = upload.parseRequest(request);
	 			  Iterator iter = items.iterator();
	 			  while(iter.hasNext()) {
	 			  FileItem item = (FileItem)iter.next();
	 			  if(item.isFormField()) {
	 			       //处理普通的表单域
	 			   }else {
	 				 processUploadedFile(item,outNet); //处理上传文件}

利用APACHE的上传包,用DEBUG试了下为什么进不了 while(iter.hasNext()) {}里面呢

我前台HTML

   <form id="formFile" action="<%=contextPath%>/act/uploadFile.act" method="post" enctype="multipart/form-data" >
   <table class="TableBlock" width="400" align="center">
    <tr class="TableLine1">
      <td nowrap>名称:</td>
      <td nowrap>     
      <input type="text" name="" id="" size="10" >&nbsp;</td>
      </td>
    </tr>
    <tr class="TableLine2">
      <td nowrap>类型:</td>
      <td nowrap>
       <select name="" id="">
       <option value="0">请选择</option>
      </select>
      </td>
      </tr>
      <tr class="TableLine2">
      <td nowrap>浏览:</td>
      <td nowrap>
       <input type="file" title="浏览" >
      </td>
    </tr>
        <tr class="TableControl">
     <td colspan="9" align="center">
      <input type="submit" value="上传"  id="upload" class="BigButton">&nbsp;&nbsp;
     </td>
    </tr>
   </table>
   </form>

举报
daishunchao
发帖于5年前 2回/275阅
顶部