jsp file upload, jspsmart instance

2011-09-13  来源:本站原创  分类:Internet  人气:165 

Jar files required: jspSmartUpload.jar
upload.html

< html >
< head >
< title > Jspsmart.html </ title >
< meta  http-equiv ="Content-Type"  content ="text/html; charset=GB2312" >
</ head >
< body > 

< h2 >  File upload example  - jspSmart </ h2 > 

< form  name ="Form1"  enctype ="multipart/form-data"  method ="post"  action ="Jspsmart.jsp" >
< p >  Upload file  1: < input  type ="file"  name ="File1"  size ="20" maxlength ="20" ></ p >
< p >  Upload file  2: < input  type ="file"  name ="File2"  size ="20" maxlength ="20" ></ p >
< input  type ="submit"  value =" Upload " >
< input  type ="reset"  value =" Clear " >
</ form > 

</ body >
</ html >

Jspsmart.jsp

<%@ page import="com.jspsmart.upload.*" %>
<%@ page contentType="text/html;charset=GB2312" %>

<html>
<head>
<title>CH9 - Jspsmart2.jsp</title>
</head>
<body>

<h2> File upload example  - jspSmart</h2>

<jsp:useBean scope="page"/>
<%
// Calculate number of file upload
int count=0;

//SmartUpload Initialization of, the use of the jspsmart Be sure to start this statement
mySmartUpload.initialize(pageContext);

// Based form to content upload
mySmartUpload.upload();

// Upload files one by one out of
for (int i=0;i<mySmartUpload.getFiles().getCount();i++)
{
// Check out a file
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);

// If the file exists, you do archive operation
if (!myFile.isMissing()) {

// Files are stored in the absolute path of the location
myFile.saveAs("C:\\upload\\" + myFile.getFileName(),

mySmartUpload.SAVE_PHYSICAL);

// Display details of this to upload files
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 ++;
}
}

//  Number displays file should upload
out.println("<BR>" + mySmartUpload.getFiles().getCount() + " files could be uploaded.<BR>");

//  Display successfully uploaded file number
out.println(count + "file(s) uploaded.");
%>

</body>
</html>
相关文章
  • jsp file upload, jspsmart instance 2011-09-13

    Jar files required: jspSmartUpload.jar upload.html < html > < head > < title > Jspsmart.html </ title > < meta http-equiv ="Content-Type" content ="text/html; charset=GB2312" > </ head > < body &g

  • JSP file upload without refresh 2010-08-09

    This carried over for a long time before http://www.javaeye.com/topic/81120 online search to find a want, personally feel good to turn up. To give button with parameters, then add the js events, such as var f = document.getElementById("form1");

  • JSP file upload feature (JSP relative path )------ JSP 2011-04-28

    upload.html page <html> <head> <title> File Upload </ title> <meta http-equiv="Content-Type" content="text/html; charset="gb2315"> </ Head> <body> <H2> Upload files </ H2> <

  • JSP File Upload Class 2010-07-12

    import java.io. *; import java.util .*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletInputStream; public class UpLoadBean ( private String SavePath = null; private String Fil

  • jsp file upload control to achieve the application code examples 2011-04-30

    html <html> <head> <title> uploading files </ title> </ Head> <body> <form action="basic.jsp Tutorial " method="post"> <input type="file" name="filer"> <br> <

  • Javaweb (6) JSP File Upload 2010-08-26

    Upload file examples are <%@ page contentType="text/html;charset=GB2312" %> <HTML> <head> <title> Upload file example </title> </head> <BODY> Upload file program application example <FORM action="

  • Several common file upload in jsp and struts Methods 2010-12-10

    Upload files using FileUpload Component File upload in web applications are very common in the environment to achieve jsp file upload feature is very easy, because there are many web development with java file upload component, this paper commons-fil

  • java file upload and download 2010-08-10

    File upload is very common in web applications , Environment to achieve jsp file upload is very easy , Because there are many online file upload using java components developed , In this paper, an example commons-fileupload component , Application to

  • flex using filereference implementation file upload / download 2010-09-06

    The following is a. Net instance, (the same basic and java, the problems are the same!) We start from the flex client to see what way the client through the server to initiate the request. flex client to complete the file upload and download are achi

  • JSP file operations file creation / check and delete 2010-09-06

    JSP file operations Daquan instance document creation / check and delete <% @ Page contentType = "text / html; charset = gb2312"%> <% @ Page import = "java.io. *"%> <html> <head> <title> documents to estab

  • structs in the file upload 2010-09-27

    Jsp file upload interface <% @ Page language = "java" import = "java.util .*" pageEncoding = "utf-8"%> <% @ Taglib uri = "/ WEB-INF/tld/struts-html.tld" prefix = "html"%> <% @ Taglib uri = &

  • Making use of common-fileUpload file upload (transfer) 2010-10-11

    Required package: commons-fileupload-1.2.1.jar and commons-io-1.3.2.jar work requirements, are directly before the upload component in struts framework, that is great, but do not have to use the framework of the , will not only upload jsp, now learn

  • jspsmart achieve file upload and download 2010-06-28

    Today, when the file uploads just get used jspsmart to achieve, so the Internet search function, download address http://jakarta.apache.org/commons/fileupload/ jspSmartUpload is www.jspsmart.com a free web site development use of full-featured file u

  • Jsp | Ajax + fileupload + json + servlet by many file upload progress bar shows 2009-04-02

    Sales: Jsp | Ajax + fileupload + json + servlet by many file upload progress bar shows demo video and screenshots download 7.55M: Download 1: mail.qq.com / cgi-bin / ftnExs_download Download 2 (javaEye): http://celerity.javaeye.com/topics/download/d1

  • Struts / JSP to upload. Preview server side documents (pictures. File. Flash. Multimedia) file components 2010-07-07

    Configuration: The first step: the need to introduce the project jar package Is currently 1.0: filemanager1.0.jar The second step: the need to configure a parameter in the web.xml file The role of parameters: the root directory of resources that site

  • Implement file upload using JSP (support Chinese) 2010-10-13

    JSP file using the upload feature to achieve the main technology used in the apache commons open source project in the two small branches (commons-fileupload-1.2.2 and commons-io-1.4), so when doing this exercise, need to http://commons.apache.org/in

  • JSP Review Notes - File Upload 2010-10-27

    SmartUpload main function is to upload a file upload pictures, can be achieved by SmartUpload 1, configuration smartupload.jar tomcat / common / lib 2, can be developed For upload pictures, general larger files, use the post If you want to upload pic

  • JSP Servlet File Upload 2011-04-23

    JSP Servlet file upload and software to achieve first is the preparation of the environment: common-fileupload component Download: http://jakarta.apache.org/commons/fileupload/ You must extract the zip package, commons-fileupload-1.0.jar will be copi

  • jsmartcom Servlet in the file upload 2010-07-05

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Create an instance of SmartUpload SmartUpload upload = new SmartUpload(); try { // Initialization upload.initialize(this.getServlet

  • java file upload from this article: Developing College http://edu.codepub.com Original link: http://edu.codepub.com/2009/1 2008-08-03

    Apache Commons fileUpload Upload files Apache The commons -fileupload.jar You can easily implement file upload functionality , This article by instance that describes how to use the commons -fileupload.jar Apache Commons fileUpload to Upload Files Ap