重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
1、下载最新的zip压缩包
创新互联始终致力于在企业网站建设领域发展。秉承“创新、求实、诚信、拼搏”的企业精神,致力为企业提供全面的网络宣传与技术应用整体策划方案,为企业提供包括“网站建设、自适应网站建设、手机网站建设、微信网站建设、成都微信小程序、商城网站定制开发、平台网站建设秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
2、从其中提取文件。
下载插件安装包后,可以看到官方给出的例子。里面文件夹的几个主要文件:jquery.uploadify.js(完成上传功能的脚本文件,在调用页面引
用)、uploadify.css(外观样式表)、uploader.swf(上传控件的主体文件,flash控件)、upload.php(服务器端处
理文件,官方仅提供了php版的)。
下面我使用的是在MyEclipse部署的java版。注意:需要加入三个commons.jar包:io、logging、fileupload。
3、导入default.css,uploadify.css,jQuery脚本,swfobject脚本和Uploadify插件。并且添加调用插件使用$,在您的网页的head部分ready事件:
%@ page language="java" contentType="text/html; charset=utf-8"%
%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
html
head
base href="%=basePath%"
titleUpload/title
!--装载文件--
link href="css/default.css" rel="stylesheet" type="text/css" /
link href="css/uploadify.css" rel="stylesheet" type="text/css" /
script type="text/javascript" src="scripts/jquery-1.3.2.min.js"/script
script type="text/javascript" src="scripts/swfobject.js"/script
script type="text/javascript" src="scripts/jquery.uploadify.v2.1.0.min.js"/script
!--ready事件--
script type="text/javascript"
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : 'uploadify.swf',
'script' : 'servlet/Upload',//后台处理的请求
'cancelImg' : 'images/cancel.png',
'folder' : 'uploads',//您想将文件保存到的路径
'queueID' : 'fileQueue',//与下面的id对应
'queueSizeLimit' :1,
'fileDesc' : 'rar文件或zip文件’,
'fileExt' : '*.rar;*.zip', //控制可上传文件的扩展名,启用本项时需同时声明fileDesc
'auto' : false,
'multi' : true,
'simUploadLimit' : 2,
'buttonText' : 'BROWSE'
});
});
/script /head
body
div id="fileQueue"/div
input type="file" name="uploadify" id="uploadify" /
p
a href="javascript:jQuery('#uploadify').uploadifyUpload()"开始上传/anbsp;
a href="javascript:jQuery('#uploadify').uploadifyClearQueue()"取消所有上传/a
/p
/body
/html
4、后台处理的upload.java
package com.xzit.upload;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
@SuppressWarnings("serial")
public class Upload extends HttpServlet {
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String savePath = this.getServletConfig().getServletContext()
.getRealPath("");
savePath = savePath + "/uploads/";
File f1 = new File(savePath);
System.out.println(savePath);
if (!f1.exists()) {
f1.mkdirs();
}
DiskFileItemFactory fac = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(fac);
upload.setHeaderEncoding("utf-8");
List fileList = null;
try {
fileList = upload.parseRequest(request);
} catch (FileUploadException ex) {
return;
}
IteratorFileItem it = fileList.iterator();
String name = "";
String extName = "";
while (it.hasNext()) {
FileItem item = it.next();
if (!item.isFormField()) {
name = item.getName();
long size = item.getSize();
String type = item.getContentType();
System.out.println(size + " " + type);
if (name == null || name.trim().equals("")) {
continue;
}
//扩展名格式:
if (name.lastIndexOf(".") = 0) {
extName = name.substring(name.lastIndexOf("."));
}
File file = null;
do {
//生成文件名:
name = UUID.randomUUID().toString();
file = new File(savePath + name + extName);
} while (file.exists());
File saveFile = new File(savePath + name + extName);
try {
item.write(saveFile);
} catch (Exception e) {
e.printStackTrace();
}
}
}
response.getWriter().print(name + extName);
}
}
5、配置处理的servlet
Web.xml文件
?xml version="1.0" encoding="UTF-8"?
web-app version="2.4"
xmlns=""
xmlns:xsi=""
xsi:schemaLocation="
"
servlet
servlet-nameupload/servlet-name
servlet-classcom.xzit.upload.Upload/servlet-class
/servlet
servlet-mapping
servlet-nameupload/servlet-name
url-pattern/servlet/Upload/url-pattern
/servlet-mapping
welcome-file-list
welcome-fileindex.jsp/welcome-file
/welcome-file-list
/web-app
6.完成。
/* jQuery实现文件上传,参考例子如下:
package com.kinth.hddpt.file.action;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import com.gdcn.bpaf.common.base.search.MyCriteria;
import com.gdcn.bpaf.common.base.search.MyCriteriaFactory;
import com.gdcn.bpaf.common.base.service.BaseService;
import com.gdcn.bpaf.common.helper.PagerList;
import com.gdcn.bpaf.common.helper.WebHelper;
import com.gdcn.bpaf.common.taglib.SplitPage;
import com.gdcn.bpaf.security.model.LogonVO;
import com.gdcn.components.appauth.common.helper.DictionaryHelper;
import com.kinth.common.base.action.BaseAction;
import com.kinth.hddpt.file.action.form.FileCatalogForm;
import com.kinth.hddpt.file.model.FileCatalog;
import com.kinth.hddpt.file.service.FileCatalogService;
import com.kinth.hddpt.file.util.MyZTreeNode;
/**
* p
* description: “文件上传的Struts层请求处理类”
* /p
* @date : 2013-1-14
*/
public class FileCatalogAction extends BaseActionFileCatalog {
@SuppressWarnings("unused")
private static Log log = LogFactory.getLog(FileCatalogAction.class); // 日志记录
private FileCatalogService fileCatalogService;
// 删除记录的同时删除相应文件
public ActionForward fileDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String[] id = request.getParameterValues("resourceId");
if (id != null id[0].contains(",")) {
id = id[0].split(",");
}
String[] fileUrls = new String[id.length];
for (int j = 0; j id.length; j++) {
fileUrls[j] = fileCatalogService.findObject(id[j]).getFileUrl();
if (!isEmpty(fileUrls[j])) {
// 如果该文件夹不存在则创建一个uptext文件夹
File fileup = new File(fileUrls[j]);
if (fileup.exists() || fileup != null) {
fileup.delete();
}
}
fileCatalogService.deleteObject(id[j]);
}
setAllActionInfos(request);
return list(mapping, form, request, response);
}
@Override
public ActionForward save(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String id = request.getParameter("resourceId");
Boolean fileFlag = Boolean.valueOf(request.getParameter("fileFlag"));
if(fileFlag != null fileFlag == true){
return super.save(mapping, form, request, response);
}else{
String fileUrl = this.fileUpload(form, request, id, fileFlag);
response.setContentType("text/html");
response.setCharacterEncoding("GBK");
response.setHeader("Charset", "GBK");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write(fileUrl);
response.getWriter().flush();
}
return null;
}
@SuppressWarnings("unchecked")
public String fileUpload(ActionForm form,HttpServletRequest request,String id,Boolean fileFlag) throws FileNotFoundException, IOException{
request.setCharacterEncoding("GBK");
String basePath = getServlet().getServletConfig().getServletContext().getRealPath("")+"/";
String filePath = "uploads/"; // 获取项目根路径 ;
/*注释部分对应jquery upload uploadify插件的后台代码,只是还存在编码问题,默认为utf-8
String savePath = getServlet().getServletConfig().getServletContext().getRealPath(""); // 获取项目根路径
savePath = savePath + "\\uploads\\";
//读取上传来的文件信息
HashtableString, FormFile fileHashtable = form.getMultipartRequestHandler().getFileElements();
EnumerationString enumeration = fileHashtable.keys();
enumeration.hasMoreElements();
String key = (String) enumeration.nextElement();
FormFile formFile = (FormFile)fileHashtable.get(key);
String filename = formFile.getFileName().trim(); //文件名
filename = new EncodeChange().changeCode(filename);
String filetype = filename.substring(filename.lastIndexOf(".") + 1);//文件类型
savePath = savePath+filetype+"\\";
System.out.println("path:"+savePath);
String realPath = savePath + filename; //真实文件路径
//如果该文件夹不存在则创建一个文件夹
File fileup = new File(savePath);
if(!fileup.exists()||fileup==null){
fileup.mkdirs();
}
if (!filename.equals("")) {
// 在这里上传文件
InputStream is = formFile.getInputStream();
OutputStream os = new FileOutputStream(realPath);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
is.close();
//如果是修改操作,则删除原来的文件
String id = request.getParameter("resourceId");
if (!isEmpty(id)) {
FileCatalog fileCatalog = fileCatalogService.findObject(id);
String fileUrl = fileCatalog.getFileUrl();
if (!isEmpty(fileUrl)) {
File filedel = new File(fileUrl);
if(filedel.exists()||filedel!=null){
filedel.delete();
}
}
request.setAttribute("entity", fileCatalog);
}
response.getWriter().print(realPath);// 向页面端返回结果信息
}*/
// 读取上传来的文件信息
HashtableString, FormFile fileHashtable = form.getMultipartRequestHandler().getFileElements();
EnumerationString enumeration = fileHashtable.keys();
enumeration.hasMoreElements();
String key = (String) enumeration.nextElement();
FormFile formFile = (FormFile) fileHashtable.get(key);
String filename = formFile.getFileName().trim(); // 文件名
String filetype = filename.substring(filename.lastIndexOf(".") + 1);// 文件类型
Integer fileSize = formFile.getFileSize();
filePath += Calendar.getInstance().get(Calendar.YEAR)+"/"+filetype+"/" ;
String realPath = basePath+filePath+filename; // 真实文件路径
if (!filename.equals("")) {
// 如果是修改操作,则删除原来的文件
if (!isEmpty(id)) {
FileCatalog fileCatalog = fileCatalogService.findObject(id);
String fileUrl = fileCatalog.getFileUrl();
if (!isEmpty(fileUrl)) {
fileUrl = basePath + fileUrl;
File filedel = new File(fileUrl);
if (filedel.exists() || filedel != null) {
filedel.delete();
}
}
request.setAttribute("entity", fileCatalog);
}
// 如果该文件夹不存在则创建一个文件夹
File fileup = new File(basePath+filePath);
if (!fileup.exists() || fileup == null) {
fileup.mkdirs();
}
// 在这里上传文件
InputStream is = formFile.getInputStream();
OutputStream os = new FileOutputStream(realPath);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
is.close();
}
filePath += filename;
String result = "{\"fileName\":\""+filename+"\",\"fileType\":\""+filetype+"\",\"fileSize\":"+fileSize+",\"fileUrl\":\""+filePath+"\"}";
return result;
}
public FileCatalogService getFileCatalogService() {
return fileCatalogService;
}
public void setFileCatalogService(FileCatalogService fileCatalogService) {
this.fileCatalogService = fileCatalogService;
}
}
Uploadify是JQuery的一个上传插件,实现的效果非常不错,带进度显示。不过官方提供的实例时php版本的,本文将详细介绍Uploadify在Aspnet中的使用,您也可以点击下面的链接进行演示或下载。
首先按下面的步骤来实现一个简单的上传功能。
1 创建Web项目,命名为JQueryUploadDemo,从官网上下载最新的版本解压后添加到项目中。
2 在项目中添加UploadHandler.ashx文件用来处理文件的上传。
3 在项目中添加UploadFile文件夹,用来存放上传的文件。
进行完上面三步后项目的基本结构如下图:
4 Default.aspx的html页的代码修改如下:
html xmlns=""
head runat="server"
titleUploadify/title
link href="JS/jquery.uploadify-v2.1.0/example/css/default.css"
rel="stylesheet" type="text/css" /
link href="JS/jquery.uploadify-v2.1.0/uploadify.css"
rel="stylesheet" type="text/css" /
script type="text/javascript"
src="JS/jquery.uploadify-v2.1.0/jquery-1.3.2.min.js"/script
script type="text/javascript"
src="JS/jquery.uploadify-v2.1.0/swfobject.js"/script
script type="text/javascript"
src="JS/jquery.uploadify-v2.1.0/jquery.uploadify.v2.1.0.min.js"/script
script type="text/javascript"
$(document).ready(function()
{
$("#uploadify").uploadify({
'uploader': 'JS/jquery.uploadify-v2.1.0/uploadify.swf',
'script': 'UploadHandler.ashx',
'cancelImg': 'JS/jquery.uploadify-v2.1.0/cancel.png',
'folder': 'UploadFile',
'queueID': 'fileQueue',
'auto': false,
'multi': true
});
});
/script
/head
body
div id="fileQueue"/div
input type="file" name="uploadify" id="uploadify" /
p
a href="javascript:$('#uploadify').uploadifyUpload()"上传/a|
a href="javascript:$('#uploadify').uploadifyClearQueue()"取消上传/a
/p
/body
/html
5 UploadHandler类的ProcessRequest方法代码如下:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Charset = "utf-8";
HttpPostedFile file = context.Request.Files["Filedata"];
string uploadPath =
HttpContext.Current.Server.MapPath(@context.Request["folder"])+"\\";
if (file != null)
{
if (!Directory.Exists(uploadPath))
{
Directory.CreateDirectory(uploadPath);
}
file.SaveAs(uploadPath + file.FileName);
//下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失
context.Response.Write("1");
}
else
{
context.Response.Write("0");
}
}
6 运行后效果如下图:
//200多个插件如下 实际开发中 请选择合适的使用
1:文件上传类jQuery插件
Ajax File Upload.
jQUploader.
Multiple File Upload plugin.
jQuery File Style.
Styling an input type file.
Progress Bar Plugin.
2:表单验证类jQuery插件
jQuery Validation.
Auto Help.
Simple jQuery form validation.
jQuery XAV – form validations.
jQuery AlphaNumeric.
Masked Input.
TypeWatch Plugin.
Text limiter for form fields.
Ajax Username Check with jQuery.
3:表单选择框类jQuery插件
jQuery Combobox.
jQuery controlled dependent (or Cascadign) Select List.
Multiple Selects.
Select box manipulation.
Select Combo Plugin.
jQuery – LinkedSelect
Auto-populate multiple select boxes.
Choose Plugin (Select Replacement).
4:表单基本、输入框、选择框等jQuery插件
jQuery Form Plugin.
jQuery-Form.
jLook Nice Forms.
jNice.
Ping Plugin.
Toggle Form Text.
ToggleVal.
jQuery Field Plugin.
jQuery Form’n Field plugin.
jQuery Checkbox manipulation.
jTagging.
jQuery labelcheck.
Overlabel.
3 state radio buttons.
ShiftCheckbox jQuery Plugin.
Watermark Input.
jQuery Checkbox (checkboxes with imags).
jQuery SpinButton Control.
jQuery Ajax Form Builder.
jQuery Focus Fields.
jQuery Time Entry.
5:时间、日期和颜色选取类jQuery插件
jQuery UI Datepicker.
jQuery date picker plugin.
jQuery Time Picker.
Time Picker.
ClickPick.
TimePicker.
Farbtastic jQuery Color Picker Plugin.
Color Picker by intelliance.fr.
6:投票类jQuery插件
jQuery Star Rating Plugin.
jQuery Star Rater.
Content rater with asp.net, ajax and jQuery.
Half-Star Rating Plugin.
7:搜索类jQuery插件
jQuery Suggest.
jQuery Autocomplete.
jQuery Autocomplete Mod.
jQuery Autocomplete by AjaxDaddy.
jQuery Autocomplete Plugin with HTML formatting.
jQuery Autocompleter.
AutoCompleter (Tutorial with PHPMySQL).
quick Search jQuery Plugin.
8:jQuery编辑器插件
jTagEditor.
WYMeditor.
jQuery jFrame.
Jeditable – edit in place plugin for jQuery.
jQuery editable.
jQuery Disable Text Select Plugin.
Edit in Place with Ajax using jQuery.
jQuery Plugin – Another In-Place Editor.
TableEditor.
tEditable – in place table editing for jQuery.
9:多媒体、视频、Flash等类jQuery插件
jMedia – accessible multi-media embedding.
JBEdit – Ajax online Video Editor.
jQuery MP3 Plugin.
jQuery Media Plugin.
jQuery Flash Plugin.
Embed QuickTime.
SVG Integration.
图片类jQuery插件
ThickBox.
jQuery lightBox plugin.
jQuery Image Strip.
jQuery slideViewer.
jQuery jqGalScroll 2.0.
jQuery – jqGalViewII.
jQuery – jqGalViewIII.
jQuery Photo Slider.
jQuery Thumbs – easily create thumbnails.
jQuery jQIR Image Replacement.
jCarousel Lite.
jQPanView.
jCarousel.
Interface Imagebox.
Image Gallery using jQuery, Interface Reflactions.
simple jQuery Gallery.
jQuery Gallery Module.
EO Gallery.
jQuery ScrollShow.
jQuery Cycle Plugin.
jQuery Flickr.
jQuery Lazy Load Images Plugin.
Zoomi – Zoomable Thumbnails.
jQuery Crop – crop any image on the fly.
Image Reflection.
10:Google地图类jQuery插件应用
jQuery Plugin googlemaps.
jMaps jQuery Maps Framework.
jQmaps.
jQuery Google Maps.
jQuery Maps Interface forr Google and Yahoo maps.
jQuery J Maps – by Tane Piper.
11:游戏类jQuery插件
Tetris with jQuery.
jQuery Chess.
Mad Libs Word Game.
jQuery Puzzle.
jQuery Solar System (not a game but awesome jQuery Stuff).
12:表格,网格类jQuery插件
UI/Tablesorter.
jQuery ingrid.
jQuery Grid Plugin.
Table Filter – awesome!.
TableEditor.
jQuery Tree Tables.
Expandable “Detail” Table Rows.
Sortable Table ColdFusion Costum Tag with jQuery UI.
jQuery Bubble.
TableSorter.
Scrollable HTML Table.
jQuery column Manager Plugin.
jQuery tableHover Plugin.
jQuery columnHover Plugin.
jQuery Grid.
TableSorter plugin for jQuery.
tEditable – in place table editing for jQuery.
jQuery charToTable Plugin.
jQuery Grid Column Sizing.
jQuery Grid Row Sizing.
13:统计类jQuery插件
jQuery Wizard Plugin .
jQuery Chart Plugin.
Bar Chart.
14:边框、圆角、背景类jQuery插件
jQuery Corner.
jQuery Curvy Corner.
Nifty jQuery Corner.
Transparent Corners.
jQuery Corner Gallery.
Gradient Plugin.
14:文字和超链接类jQuery插件
jQuery Spoiler plugin.
Text Highlighting.
Disable Text Select Plugin.
jQuery Newsticker.
Auto line-height Plugin.
Textgrad – a text gradient plugin.
LinkLook – a link thumbnail preview.
pager jQuery Plugin.
shortKeys jQuery Plugin.
jQuery Biggerlink.
jQuery Ajax Link Checker.
15:文本提示类jQuery插件
jQuery Plugin – Tooltip.
jTip – The jQuery Tool Tip.
clueTip.
BetterTip.
Flash Tooltips using jQuery.
ToolTip.
16:菜单和导航类jQuery插件
jQuery Tabs Plugin – awesome! . [demo nested tabs.]
another jQuery nested Tab Set example (based on jQuery Tabs Plugin).
jQuery idTabs.
jdMenu – Hierarchical Menu Plugin for jQuery.
jQuery SuckerFish Style.
jQuery Plugin Treeview.
treeView Basic.
FastFind Menu.
Sliding Menu.
Lava Lamp jQuery Menu.
jQuery iconDock.
jVariations Control Panel.
ContextMenu plugin.
clickMenu.
CSS Dock Menu.
jQuery Pop-up Menu Tutorial.
Sliding Menu.
17:幻灯片、手风琴特效类jQuery插件
jQuery Plugin Accordion.
jQuery Accordion Plugin Horizontal Way.
haccordion – a simple horizontal accordion plugin for jQuery.
Horizontal Accordion by portalzine.de.
HoverAccordion.
Accordion Example from fmarcia.info.
jQuery Accordion Example.
jQuery Demo – Expandable Sidebar Menu.
Sliding Panels for jQuery.
jQuery ToggleElements.
Coda Slider.
jCarousel.
Accesible News Slider Plugin.
Showing and Hiding code Examples.
jQuery Easing Plugin.
jQuery Portlets.
AutoScroll.
Innerfade.
18:拖放类jQuery插件
UI/Draggables.
EasyDrag jQuery Plugin.
jQuery Portlets.
jqDnR – drag, drop resize.
Drag Demos.
19:XML XSL JSON Feeds相关jQuery插件
XSLT Plugin.
jQuery Ajax call and result XML parsing.
xmlObjectifier – Converts XML DOM to JSON.
jQuery XSL Transform.
jQuery Taconite – multiple Dom updates.
RSS/ATOM Feed Parser Plugin.
jQuery Google Feed Plugin.
20:浏览器
Wresize – IE Resize event Fix Plugin.
jQuery ifixpng.
jQuery pngFix.
Link Scrubber – removes the dotted line onfocus from links.
jQuery Perciformes – the entire suckerfish familly under one roof.
Background Iframe.
QinIE – for proper display of Q tags in IE.
jQuery Accessibility Plugin.
jQuery MouseWheel Plugin.
21:警告, 提示, 确认等对话框
jQuery Impromptu.
jQuery Confirm Plugin.
jqModal.
SimpleModal.
CSS
jQuery Style Switcher.
JSS – Javascript StyleSheets.
jQuery Rule – creation/manipulation of CSS Rules.
jPrintArea.
22:DOM、AJAX和其它JQuery插件
FlyDOM.
jQuery Dimenion Plugin.
jQuery Loggin.
Metadata – extract metadata from classes, attributes, elements.
Super-tiny Client-Side Include Javascript jQuery Plugin.
Undo Made Easy with Ajax.
JHeartbeat – periodically poll the server.
Lazy Load Plugin.
Live Query.
jQuery Timers.
jQuery Share it – display social bookmarking icons.
jQuery serverCookieJar.
jQuery autoSave.
jQuery Puffer.
jQuery iFrame Plugin.
Cookie Plugin for jQuery.
jQuery Spy – awesome plugin.
Effect Delay Trick.
jQuick – a quick tag creator for jQuery..
var
elementIds=["flag"];
//flag为id、name属性名
$.ajaxFileUpload({
url:
'uploadAjax.htm',
type:
'post',
secureuri:
false,
//一般设置为false
fileElementId:
'file',
//
上传文件的id、name属性名
dataType:
'text',
//返回值类型,一般设置为json、application/json
elementIds:
elementIds,
//传递参数到服务器
success:
function(data,
status){
alert(data);
},
error:
function(data,
status,
e){
alert(e);
}
});
1、uploadify
它是针对jQuery的免费文件上传插件,可以轻松将单个或多个文件上传到网站上,可控制并发上传的文件数,通过接口参数和CSS控制外观。Web服务器需支持flash和后端开发语言。
2、FancyUpload
它是一个由CSS和XHTML编写样式的Ajax文件上传工具,安装简便,服务器独立,由MooTools模块驱动,可以在任何现代浏览器上使用。
3、Aurigma Upload Suite(Image Uploader)
这是一个不限大小,不限格式的文件/图片批量上传工具,是收费控件。它支持云端存储和客户端文件处理,支持断点续传,稳定可靠。从8.0.8开始,Image Uploader将名称改为"Aurigma Upload Suite"。