zoukankan      html  css  js  c++  java
  • 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;                 }             });
  • 相关阅读:
    我的知识库(4) java获取页面编码(Z)
    知识库(3)JAVA 正则表达式 (超详细)
    The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts
    某人总结的《英语听力的技巧 》,挺搞的
    我的知识库(5)java单例模式详解
    构建可扩展程序
    SerialPort (RS232 Serial COM Port) in C# .NET
    Python学习笔记——String、Sequences
    UI题目我的答案
    jQuery学习系列学会操纵Form表单元素(1)
  • 原文地址:https://www.cnblogs.com/wujianfeng/p/3424106.html
Copyright © 2011-2022 走看看