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

📄 sample2.jsp

📁 一个完整的门户网站,基于JSP环境下开发的,使用SQL数据库.
💻 JSP
字号:
<%@ page language="java" import="com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />

<HTML>
<BODY BGCOLOR="white">

<H1>jspSmartUpload : Sample 2</H1>
<HR>

<%
	
	// Variables
	int count=0;        

	// Initialization
	mySmartUpload.initialize(pageContext);

	// Upload	
	mySmartUpload.upload();

	// Select each file
	for (int i=0;i<mySmartUpload.getFiles().getCount();i++){

		// Retreive the current file
		com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);

		// Save it only if this file exists
		if (!myFile.isMissing()) {

			// Save the files with its original names in a virtual path of the web server       
			myFile.saveAs("/upload/" + myFile.getFileName());
			// myFile.saveAs("/upload/" + myFile.getFileName(), mySmartUpload.SAVE_VIRTUAL);

			// sample with a physical path
			// myFile.saveAs("c:\\temp\\" + myFile.getFileName(), mySmartUpload.SAVE_PHYSICAL);

			//  Display the properties of the current file
			out.println("FieldName = " + myFile.getFieldName() + "<BR>");
			out.println("Size = " + myFile.getSize() + "<BR>");
			out.println("FileName = " + myFile.getFileName() + "<BR>");
			out.println("FileExt = " + myFile.getFileExt() + "<BR>");
			out.println("FilePathName = " + myFile.getFilePathName() + "<BR>");
			out.println("ContentType = " + myFile.getContentType() + "<BR>");
			out.println("ContentDisp = " + myFile.getContentDisp() + "<BR>");
			out.println("TypeMIME = " + myFile.getTypeMIME() + "<BR>");
			out.println("SubTypeMIME = " + myFile.getSubTypeMIME() + "<BR>");

			count ++;

		}

	}

	// Display the number of files which could be uploaded 
	out.println("<BR>" + mySmartUpload.getFiles().getCount() + " files could be uploaded.<BR>");

	// Display the number of files uploaded 
	out.println(count + " file(s) uploaded.");


%>
</BODY>
</HTML>

⌨️ 快捷键说明

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