Atitit. file upload with progress bar atiup Design Java C # php
1. Design Requirements 1
2. Principle and architecture 1
3. UI 2
4. Spring MVC 2
5. Springmvc.xml 3
6. Struts Extand URL 3
7. Behide Code 3
8. Simplified Design 3
1. Design Requirements
With progress bar
Finish prompting animation effect ...
2. Principle andArchitecture
Show file upload progress in real time if you need to display a progress bar
Need to use AJAXJ technology. Up to an IFRAME in the blackheads.
Working principle
It is actually in the process of uploading files at the same time, the upload progress information such as the total length of the file, the number of uploads, the transfer rate is written to the session, the client browser
Using AJAX technology to open a new independent process from the session to get upload progress information, and real-time display, Ajax technology can not refresh the page to get server data. Session
Can be seen as server memory and can be used to hold a small amount of customer information.
Upload Listener
Commons-fileupload version 1.2 supports upload monitoring, only need to implement a listener, and add it to the upload component. The listener needs to implement its Progresslistener
Author:: Old Wow's paw attilax Ayron, email:[email protected]
Reprint please indicate source: Http://blog.csdn.net/attilax
3. UI
Prj.wechatadm4prop
house_list.jsp
<iframe id= "upifrm" src= "Up.jsp?callx=callo7" marginwidth= "0" marginheight= "0" scrolling= "no" frameborder= "0" Style= "width:100%; height:60px "></iframe>
function callO7 (path)
{
alert (path);
$ ("#filex"). val (path);
Oktips ();
}
4. Spring MVC
Xml
<!--spring MVC start p3h--
<!--o7h ATI ---
<servlet>
<servlet-name>spring</ servlet-name >
<servlet-class > Org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextconfiglocation </ Param-name>
<param-value>/web-inf/springmvc.xml</ Param-value >
</init-param>
<load-on-startup>1</load-on-startup >
</servlet>
<!--///o7h --
<servlet-mapping>
<servlet-name>spring</ servlet-name >
<!--here in spring, write a file named Spring-servlet.xml, which is used primarily to configure its controller- -
<url-pattern>/spr/* </ Url-pattern>
</servlet-mapping>
<!--spring MVC start p3h end --
5. Springmvc.xml
< Mvc:annotation-driven />
< Context:annotation-config />
< Context:component-scan Base-package = "junit4,com.im,com.im.**,com.attilax.up.**,com.focusx.dictionary.action.**" />
< Bean class = "Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
6. Struts Extand URL
<constant name="Struts.action.excludePattern" value ="/dwr/.*,/dwr/test/.*,/spr/.*,/eqmntrun.jsp,/vod/eqmntrun.jsp,/comm/.*,/house/.*" ></constant>
7. Behide Code
/wechatadmin4propt/src/com/attilax/up/fileuploadcontroller.java
8. Simplified design
up_smp.jsp
Reference
Atitit. File upload with progress bar implementation principle and Component Selection and Best Practice summary O7
Atitit. File upload with progress bar atiup design Java C # PHP