コード例 #1
0
        private string UploadToLocal(HttpContext context)
        {
            //上传配置
            string pathbase = System.Configuration.ConfigurationManager.AppSettings["UploadFilePath"];//保存路径

            if (!pathbase.StartsWith("/"))
            {
                pathbase = "/" + pathbase;
            }
            if (!pathbase.EndsWith("/"))
            {
                pathbase += "/";
            }
            pathbase += "UMeditorUpload/";
            int size = 10;                                                   //文件大小限制,单位mb

            string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式

            //上传图片
            Hashtable    info;
            FileUploader up = new FileUploader();

            info = up.UpFileToLocal(context, pathbase, filetype, size); //获取上传状态
            return(BuildJson(info));
        }