⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uploadfileproperty.jsp

📁 jsp动态网站开发与实例(第3版) 源码
💻 JSP
字号:
	<html>
	  <head>
	    <title></title>
	  </head>
	  <body>
	  <form action="uploadFileProperty.jsp"  
	        enctype="multipart/form-data" name=theFile  method="post" > 
	      <input type=file name=theFirstFile size=50 /> <br>
	      <input type=file name=theSecondFile size=50 /> <br>
	      <input type=submit name=submitButton value="上传"   />
	  </form>
	  </body>
	</html>
uploadSmart/uploadFileProperty.jsp
	<%@page contentType="text/html"%>
	<%@page pageEncoding="Ms950"%>
	<%@page import="com.jspsmart.upload.*" %>
	
	<jsp:useBean id="theSmartUpload" scope="page" 
	                    class="com.jspsmart.upload.SmartUpload"   />
	<html>
	    <head><title>上传文件操作</title></head>
	    <body>
	    <%
	        theSmartUpload.initialize(pageContext) ; 
	        theSmartUpload.setTotalMaxFileSize(10*1024*1024) ; 
	        theSmartUpload.setAllowedFilesList("txt,htm") ; 
	        theSmartUpload.upload() ; 
	        String savePath = "C:\\saveDir\\" ;        
	        int fileCount=theSmartUpload.save(savePath) ; 
	        out.println("成功上传文件数目:"+fileCount  ) ;         
	        
	        Files theFiles = theSmartUpload.getFiles() ; 
	        out.println("<br>") ;
	        out.println("=========================<br>") ; 
	        for(int i=0 ;i<theFiles.getCount();i++ ){   
	            
	            File theFile =theFiles.getFile(i) ;
	            out.println("属性名称:"+theFile.getFieldName()+"<br>") ; 
	            out.println("文件名称:"+theFile.getFileName()+"<br>") ; 
	            out.println("扩展名:"+theFile.getFileExt()+"<br>") ; 
	            out.println("文件路径:"+theFile.getFilePathName()+"<br>") ; 
	            out.println("文件类型:"+theFile.getContentType()+"<br>") ; 
	            out.println("文件大小:"+theFile.getSize()+"<br>") ; 
	            out.println("<br>") ;          
	            
	            theFile.saveAs("C:\\saveDir\\CopyFile\\copy_"+
	                    theFile.getFileName(),theSmartUpload.SAVE_AUTO) ; 
	            out.println("复制一份文件至"+
	                    "C:\\saveDir\\CopyFile\\copy_"+theFile.getFileName()) ; 
	            out.println("<br>") ;
	            out.println("=================<br>") ; 
	        } 
	    %>    
	    </body>
	</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -