uploadify上传的文件

 /*上传图片必须加入这个解决302错误*/
            /*1.在Global.asax.cn文件里添加*/
            #region by xsn 7818999 for uploadify
            if (!IsPostBack)
            {
                StringBuilder sb = new StringBuilder("<script type=\"text/javascript\">");
                sb.Append("var auth = \"");
                sb.Append(Request.Cookies[FormsAuthentication.FormsCookieName] == null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value);
                sb.Append("\";");
                sb.Append("var ASPSESSID = \"");
                sb.Append(Session.SessionID);
                sb.Append("\";</script>");
                litScirpt.Text = sb.ToString();
            }
            #endregion
 jQuery("#ID").uploadify({
                'formData': { 'ASPSESSID': ASPSESSID, 'AUTHID': auth },
                'buttonText''设计稿细节图',
                'width''120''height''20',
                'auto'true,
                'method'"GET",
                'successTimeout': 99999,
                'swf''/js/plugins/uploadify/uploadify.swf?r=' + Math.round(Math.random() * 10),
                'uploader'"/main/des/ajax/DesignDraft.ashx?operating=upLoadify&r=" + Math.round(Math.random() * 10),
                'fileSizeLimit''300',
                'mulit'false,
                'progressData''speed',
                'overrideEvents': ['onDialogClose'],
                'fileTypeExts''*.jpg;*.bmp',
                'onSelectError'function (file, errorCode, errorMsg) {
                    switch (errorCode) {
                        case -100:
                            alert("上传的文件数量已经超出系统限制的" + jQuery('#ID').uploadify('settings', 'queueSizeLimit') + "个文件!");                             break;                    
     case -110:                        
     alert("文件 [" + file.name + "] 大小超出系统限制的" + jQuery('#ID').uploadify('settings', 'fileSizeLimit') + "KB!");                             break;                         case -120:                             alert("文件 [" + file.name + "] 大小异常!");                             break;                         case -130:                             alert("文件 [" + file.name + "] 类型不正确!");                             break;                     }                 },                 'onClearQueue': function (queueItemCount) {                     alert("取消上传");                     return;                 },                 'onUploadSuccess': function (file, Data, Response) {                     var json = $.parseJSON(Data);                     if (json.success) {                         $.messager.alert("温馨提示", "设计稿细节图上传成功!");                         $("#img1").attr("src", json.msg);                         $("#SYTLE_PATH").val(json.msg);                     }                     else {                         $.messager.alert("温馨提示", "设计稿细节图上传失败");                     }                     return;                 }             });

posted on 2013-11-14 20:44  峰翼  阅读(197)  评论(0编辑  收藏  举报

导航