最近做项目中碰到上传需要显示进度的问题,通过uploadfiy很好的解决了这个问题不过(IE9出现了按钮不能点击的问题,至今仍找不到良策)

在使用uploadfiy3.2版本时需要下载jquery.tmpl.min.js并引用在Jquery下面

 $("#uploadify").uploadify({
'uploader': '/LZKS/Handler/BigFileUpLoadHandler.ashx',
'swf': '/LZKS/Scripts/uploadify/uploadify.swf',
'cancelImage': '/LZKS/Scripts/uploadify/cancel.png',
'queueID': 'fileQueue',
//'auto': false,
'multi': true,
'buttonText': '文件上传',
'formData': { 'ASPSESSID': ASPSESSID, 'AUTHID': auth },
'onSelect': function (file) {
$('#uploadify').uploadifySettings('formData', { 'ASPSESSID': ASPSESSID, 'AUTHID': auth });
alert(formDate);
},
'onComplete': function (file, data, response) {
}, 'onQueueComplete': function () {
alert("上传完成!");
$('#fileQueue').attr('style', 'visibility :hidden');
},
'onSelectError': function (file, errorCode, errorMsg) {
$('#fileQueue').attr('style', 'visibility :hidden');
},
'onUploadStart': function (file) {
$('#fileQueue').attr('style', 'top:200px;left:400px;width:400px;height :400px;visibility :visible');
}
});
});

用uplodify上传还有一个小问题就是在FF下session将会出现丢失的情况 ,在Gobal中加入如下代码来将上传过程中定义的session传至服务器上

 protected void Application_BeginRequest(object sender, EventArgs e)
{
/* we guess at this point session is not already retrieved by application so we recreate cookie with the session id... */
try
{
string session_param_name = "ASPSESSID";
string session_cookie_name = "ASP.NET_SessionId"; if (HttpContext.Current.Request.Form[session_param_name] != null)
{
UpdateCookie(session_cookie_name, HttpContext.Current.Request.Form[session_param_name]);
}
else if (HttpContext.Current.Request.QueryString[session_param_name] != null)
{
UpdateCookie(session_cookie_name, HttpContext.Current.Request.QueryString[session_param_name]);
}
}
catch
{
} try
{
string auth_param_name = "AUTHID";
string auth_cookie_name = FormsAuthentication.FormsCookieName; if (HttpContext.Current.Request.Form[auth_param_name] != null)
{
UpdateCookie(auth_cookie_name, HttpContext.Current.Request.Form[auth_param_name]);
}
else if (HttpContext.Current.Request.QueryString[auth_param_name] != null)
{
UpdateCookie(auth_cookie_name, HttpContext.Current.Request.QueryString[auth_param_name]);
} }
catch
{
}
} private void UpdateCookie(string cookie_name, string cookie_value)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(cookie_name);
if (null == cookie)
{
cookie = new HttpCookie(cookie_name);
}
cookie.Value = cookie_value;
HttpContext.Current.Request.Cookies.Set(cookie);
}

在JS加载前面定义下面两个变量

 var auth = "<% = Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value %>";
var ASPSESSID = "<%= Session.SessionID %>";
Handler文件代码如下:
public class BigFileUpLoadHandler : IHttpHandler, IRequiresSessionState
{
DALFile Fdal = new DALFile();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
VideoUpLoad(context, CLSOFT.Web.LZKS.Edu.Globe.filename);
}
public void VideoUpLoad(HttpContext context, string fileFolderName)
{
context.Response.Charset = "utf-8";
string aaaaaaa=context.Request.QueryString["sessionid"];
HttpPostedFile file = context.Request.Files["Filedata"];
string uploadPath = HttpContext.Current.Server.MapPath(UploadFileCommon.CreateDir(fileFolderName));
if (file != null)
{
if (!Directory.Exists(uploadPath))
{
Directory.CreateDirectory(uploadPath);
}
Model.ModelFile model = new Model.ModelFile();
model.File_ID = Guid.NewGuid().ToString();
model.File_Name = file.FileName;
model.File_Path = UploadFileCommon.CreateDir(fileFolderName);
model.File_Size = file.ContentLength;
model.File_Extension = file.FileName.Substring(file.FileName.LastIndexOf('.') + 1);
model.File_Date = DateTime.Now;
model.File_CurrentMan = CLSOFT.Web.LZKS.Edu.Globe.name;
file.SaveAs(uploadPath + model.File_Name); List<Model.ModelFile> list = null;
if (context.Session["File"] == null)
{
list = new List<Model.ModelFile>();
}
else
{
list = context.Session["File"] as List<Model.ModelFile>;
}
list.Add(model);
context.Session.Add("File", list);
}
else
{
context.Response.Write("0");
}
}
//这段代码的功能是将多文件的信息存到context.Session["File"] as List<Model.ModelFileModel.ModelFile>为文件信息类
//实现批量上传的信息给Session

3.2版uploadify详细例子(含FF和IE SESSION问题)的更多相关文章

  1. Ubuntu 16.04安装QQ国际版图文详细教程

            因工作需要,我安装了Ubuntu 16.04,但是工作上的很多事情需要QQ联系,然而在Ubuntu上的WebQQ很是不好用,于是在网上搜索了好多个Linux版本的QQ,然而不是功能不全 ...

  2. ThinkPHP 自动创建数据、自动验证、自动完成详细例子介绍(十九)

    原文:ThinkPHP 自动创建数据.自动验证.自动完成详细例子介绍(十九) 1:自动创建数据 //$name=$_POST['name']; //$password=$_POST['password ...

  3. 批处理bat脚本编写(附详细例子)

                                                        批处理bat脚本编写(附详细例子) 由于在项目开发的过程中经常需要编写bat脚本,而看大牛们编写 ...

  4. Java 序列化Serializable详解(附详细例子)

    Java 序列化Serializable详解(附详细例子) 1.什么是序列化和反序列化 Serialization(序列化)是一种将对象以一连串的字节描述的过程:反序列化deserialization ...

  5. MySQL5.7免安装版配置详细教程

    MySQL5.7免安装版配置详细教程 一. 软件下载 Mysql是一个比较流行且很好用的一款数据库软件,如下记录了我学习总结的mysql免安装版的配置经验,要安装的朋友可以当做参考哦 mysql5.7 ...

  6. MySQL5.7.25解压版安装详细教程

    MySQL5.7.25解压版安装详细教程 安装步骤: 1.首先,你要下载MySQL解压版,下载地址:https://www.mysql.com/downloads/,图解: 2.解压安装包,根据自己的 ...

  7. MySQL 5.7.20绿色版安装详细图文教程

    MySQL 5.7.20绿色版安装详细图文教程 MySQL是一个关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle旗下产品.这篇文章主要介绍了MySQL 5.7.20绿色版安装 ...

  8. Java 序列化Serializable详解(附详细例子)

    Java 序列化Serializable详解(附详细例子) 1.什么是序列化和反序列化Serialization(序列化)是一种将对象以一连串的字节描述的过程:反序列化deserialization是 ...

  9. Windows(x86,64bit)升级MySQL 5.7.17免安装版的详细教程

    MySQL需要升级到5.5.3以上版本才支持Laravel 5.4默认的utf8mb64字符编码.因此就把MySQL升级了一下,期间还是遇到些小问题,记录一下以供参考. 升级准备 备份之前MySql目 ...

随机推荐

  1. NGUI系列教程九(自制ListView)

    在NGUI中可以很方便的实现ListView的控件,ListView就好比IOS或Android平台中使用手势上下拖动的控件.在Unity3D中实现ListView的原理无非就两种,第一种是摄像机不动 ...

  2. iOS 支付宝应用(备用参考2)

    接入前期准备工作包括商户签约和密钥配置 步骤1:  启动IDE(如Xcode),把iOS包中的压缩文件中以下文件拷贝到项目文件夹下, 并导入到项目工程中. AlipaySDK.bundle    Al ...

  3. tableView的基本使用(改良版)

    @interface ViewController ()<UITableViewDataSource, UITableViewDelegate> { int i;//用来计算接受通知的次数 ...

  4. linux编程之指针

    这个是数组指针.指针数组.二维数组之间相互转换的代码 #include<stdio.h> void main() { ][]={,,,,,,,}; int *b=NULL; int **c ...

  5. java第二课:运算符和表达式

    1.取模%,如果余数为零,则判断可以整除.2.余数永远小于除数.3.自增运算符++或自减运算符--单独使用时,前++.--后++.--效果是一样的4.先加一,后使用,前++:先使用,后加一,后++5. ...

  6. sql视图学习笔记--视图

    视图是为用户对数据多种显示需求而创建的,其主要用在一下几种情况: (1)限制用户只能访问特定表特定条件的内容,提高系统的安全性. (2)隐藏表结构.创建多种形式的数透视,满足不同用户需求. (3)将复 ...

  7. Extjs4.2布局——Ext.container.ViewportView

    先贴出官方文档的关于此布局的描述:“ 一个专门的容器用于可视应用领域(浏览器窗口). Viewport渲染自身到网页的documet body区域, 并自动将自己调整到适合浏览器窗口的大小,在窗口大小 ...

  8. encodeURIComponent()编码和decodeURIComponent()解码

    html1: <!DOCTYPE HTML> <meta charset=utf-8> <meta http-equiv="X-UA-Compatible&qu ...

  9. 【DP/单调栈】关于单调栈的一些题目(codevs 1159,codevs 2673)

    CODEVS 2673:Special Judge 题目描述 Description   这个月的pku月赛某陈没有参加,因为当时学校在考试[某陈经常逃课,但某陈还没有强大到考试也可以逃掉的程度].何 ...

  10. 团体程序设计天梯赛-练习集L1-019. 谁先倒

    L1-019. 谁先倒 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 划拳是古老中国酒文化的一个有趣的组成部分.酒桌上两人划拳 ...