日期:2014-05-18  浏览次数:20378 次

FlashUpload 一次多选文件上传乱码问题
RT,
最近开始搞一个多文件上传的问题,将案例引入到项目中的时候,出现了文件名称乱码的问题?
不知道各位遇到过没有?
1.自己检查了这个项目的编码格式web.config都写写好的,
C# code

<globalization requestEncoding="gb2312" responseEncoding="gb2312" fileEncoding="gb2312"/>


2.页面文件的编码:
C# code

<%@ Page Language="C#" ResponseEncoding="gb2312" 

<meta content="text/html; charset=gb2312" http-equiv="Content-Type">



3.将页面文件用TXT打开重新设置了保存时的编码为: UTF-8 
共有(ANSI,UTF-8,Unicode,Unicode big endia)

4.
这个是案例的项目结构,他将 FileUpload 封装为了一个类库。


C# code

 public class FlashUpload : Control
    {
        private const string FLASH_SWF = "FlashUpload.FlashFileUpload.swf";

        [Category("Behavior")]
        [Description("The page to upload files to.")]
        [DefaultValue("")]
        public string UploadPage
        {
            get
            {
                object o = ViewState["UploadPage"];
                if (o == null)
                    return "";
                return o.ToString();
            }
            set { ViewState["UploadPage"] = value; }
        }

        [Category("Behavior")]
        [Description("Query Parameters to pass to the Upload Page.")]
        [DefaultValue("")]
        public string QueryParameters
        {
            get
            {
                object o = ViewState["QueryParameters"];
                if (o == null)
                    return "";
                return o.ToString();
            }
            set { ViewState["QueryParameters"] = value; }
        }

        [Category("Behavior")]
        [Description("Javascript function to call when all files are uploaded.")]
        [DefaultValue("")]
        public string OnUploadComplete
        {
            get
            {
                object o = ViewState["OnUploadComplete"];
                if (o == null)
                    return "";
                return o.ToString();
            }
            set { ViewState["OnUploadComplete"] = value; }
        }

        [Category("Behavior")]
        [Description("The maximum file size that can be uploaded, in bytes (0 for no limit).")]
        public decimal UploadFileSizeLimit
        {
            get
            {
                object o = ViewState["UploadFileSizeLimit"];
                if (o == null)
                    return 0;
                return (decimal)o;
            }
            set { ViewState["UploadFileSizeLimit"] = value; }
        }

        [Category("Behavior")]
        [Description("The total number of bytes that can be uploaded (0 for no limit).")]
        public decimal TotalUploadSizeLimit
        {
            get
            {
                object o = ViewState["TotalUploadSizeLimit"];
                if (o == null)
                    return 0;
                return (decimal)o;
            }
            set { ViewState["TotalUploadSizeLimit"] = value; }
        }

        [Category("Behavior")]
        [Description("The description of file types that you want uploads restricted to (ex. Images (*.JPG;*.JPEG;*.JPE;*.GIF;*.PNG;))")]
        [DefaultValue("")]
        public string FileTypeDescription
        {
            get
            {