您目前尚未登陆,请选择【登陆】或【注册
首页->会员管理->多层结构会员管理系统源码>>FCKeditor.Net_2.2/FileWorkerBase.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:多层结构会员管理系统源码


当前文件路径:mvcMemberShip/FCKeditor.Net_2.2/FileWorkerBase.cs 文件类型
普通视图
		            
1/* 2 * FCKeditor - The text editor for internet 3 * Copyright (C) 2003-2005 Frederico Caldeira Knabben 4 * 5 * Licensed under the terms of the GNU Lesser General Public License: 6 * http://www.opensource.org/licenses/lgpl-license.php 7 * 8 * For further information visit: 9 * http://www.fckeditor.net/ 10 * 11 * "Support Open Source software. What about a donation today?" 12 * 13 * File Name: FileWorkerBase.cs 14 * Base class used by the FileBrowserConnector and Uploader. 15 * 16 * File Authors: 17 * Frederico Caldeira Knabben (fredck@fckeditor.net) 18 */ 19 20using System; 21 22namespace FredCK.FCKeditorV2 23{ 24 public abstract class FileWorkerBase : System.Web.UI.Page 25 { 26 private const string DEFAULT_USER_FILES_PATH = "/UserFiles/"; 27 private const string DEFAULT_UPLOAD_DENIED_EXTENSIONS = ".php|.php3|.php5|.phtml|.asp|.aspx|.ascx|.jsp|.cfm|.cfc|.pl|.bat|.exe|.dll|.reg|.cgi|.cs|.vb|.asa|.cer|c.dx|.ascx|.asax|.ashx|.asmx|.java|.jsl"; 28 29 private string sUserFilesPath; 30 private string sUserFilesDirectory; 31 private string sUploadDeniedExtensions; 32 33 protected string UserFilesPath 34 { 35 get 36 { 37 if (sUserFilesPath == null) 38 { 39 // Try to get from the "Application". 40 sUserFilesPath = (string)Application["FCKeditor:UserFilesPath"]; 41 42 // Try to get from the "Session". 43 if (sUserFilesPath == null || sUserFilesPath.Length == 0) 44 { 45 sUserFilesPath = (string)Session["FCKeditor:UserFilesPath"]; 46 47 // Try to get from the Web.config file. 48 if (sUserFilesPath == null || sUserFilesPath.Length == 0) 49 { 50 sUserFilesPath = System.Configuration.ConfigurationSettings.AppSettings["FCKeditor:UserFilesPath"]; 51 52 // Otherwise use the default value. 53 if (sUserFilesPath == null || sUserFilesPath.Length == 0) 54 sUserFilesPath = DEFAULT_USER_FILES_PATH; 55 56 // Try to get from the URL. 57 if (sUserFilesPath == null || sUserFilesPath.Length == 0) 58 { 59 sUserFilesPath = Request.QueryString["ServerPath"]; 60 } 61 } 62 } 63 64 // Check that the user path ends with slash ("/") 65 if (!sUserFilesPath.EndsWith("/")) 66 sUserFilesPath += "/"; 67 ////ResolveUrl add by tupunco 2006-10-9 68 if (sUserFilesPath.StartsWith("~")) 69 sUserFilesPath = this.ResolveUrl(sUserFilesPath); 70 } 71 return sUserFilesPath; 72 } 73 } 74 75 /// <summary> 76 /// The absolution path (server side) of the user files directory. It 77 /// is based on the <see cref="FileWorkerBase.UserFilesPath"/>. 78 /// </summary> 79 protected string UserFilesDirectory 80 { 81 get 82 { 83 if (sUserFilesDirectory == null) 84 { 85 // Get the local (server) directory path translation. 86 sUserFilesDirectory = Server.MapPath(this.UserFilesPath); 87 } 88 return sUserFilesDirectory; 89 } 90 } 91 92 /// <summary> 93 /// Denied File's Extensions 94 /// 不被允许的文件扩展名 95 /// AppSettings["FCKeditor:UploadDeniedExtensions"] 96 /// 适用方法可以参看UserFilesPath属性设置方法 97 /// </summary> 98 public string UploadDeniedExtensions 99 { 100 get 101 { 102 if (sUploadDeniedExtensions == null) 103 { 104 // Try to get from the "Application". 105 sUploadDeniedExtensions = (string)Application["FCKeditor:UploadDeniedExtensions"]; 106 107 // Try to get from the "Session". 108 if (sUploadDeniedExtensions == null || sUploadDeniedExtensions.Length == 0) 109 { 110 sUploadDeniedExtensions = (string)Session["FCKeditor:UploadDeniedExtensions"]; 111 112 // Try to get from the Web.config file. 113 if (sUploadDeniedExtensions == null || sUploadDeniedExtensions.Length == 0) 114 { 115 sUploadDeniedExtensions = System.Configuration.ConfigurationSettings.AppSettings["FCKeditor:UploadDeniedExtensions"]; 116 117 // Otherwise use the default value. 118 if (sUploadDeniedExtensions == null || sUploadDeniedExtensions.Length == 0) 119 sUploadDeniedExtensions = DEFAULT_UPLOAD_DENIED_EXTENSIONS; 120 } 121 } 122 } 123 return sUploadDeniedExtensions; 124 } 125 } 126 /// <summary> 127 /// Check Can Upload this file 128 /// 判断文件类型是否可以上传 129 /// </summary> 130 /// <param name="sFileName">will upload file's name将要上传的文件名</param> 131 /// <returns></returns> 132 public bool CheckUploadFileExtension(string sFileName) 133 { 134 //Denied Extensions Array 135 //不被允许的文件扩展名数组 136 string[] aExtensions = this.UploadDeniedExtensions.Split(new char[] { '|' }); 137 //将要上传的文件扩展名 138 string fileEx = System.IO.Path.GetExtension(sFileName); 139 foreach (string ex in aExtensions) 140 { 141 if (ex == fileEx) 142 return false; 143 } 144 return true; 145 } 146 } 147} 148
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:多层结构会员管理系统源码

- Ajax会员管理源码

- 东网论坛5.22项目文件及源码

- x3blog1.0.0多用户Beta2版源码

- 三层结构用户,角色,功能管理模块

- IP锁定程序实例源码

- 某大学211工程办公室网站源码..

- 信管家园整站系统源码

- 明日物流管理系统(Asp.net2.0)

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号