您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->MyWebPages51aspx汉化最终版>>App-Code/FCKEditor/Uploader.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:MyWebPages51aspx汉化最终版
当前文件:文件类型 MyWebPagesStarterKit/App_Code/FCKEditor/Uploader.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: Uploader.cs 14 * This is the code behind of the uploader.aspx page used for Quick Uploads. 15 * 16 * File Authors: 17 * Frederico Caldeira Knabben (fredck@fckeditor.net) 18 */ 19 20using System ; 21using System.Globalization ; 22using System.Xml ; 23using System.Web ; 24using System.IO; 25 26namespace FredCK.FCKeditorV2 27{ 28 public class Uploader : FileWorkerBase 29 { 30 protected override void OnLoad(EventArgs e) 31 { 32 // Get the posted file. 33 HttpPostedFile oFile = Request.Files["NewFile"] ; 34 35 // Check if the file has been correctly uploaded 36 if ( oFile == null || oFile.ContentLength == 0 ) 37 { 38 SendResults( 202 ) ; 39 return ; 40 } 41 42 int iErrorNumber = 0 ; 43 string sFileUrl = "" ; 44 string sResourceType = "Image"; 45 46 // Get the uploaded file name. 47 string sFileName = System.IO.Path.GetFileName( oFile.FileName ) ; 48 49 int iCounter = 0 ; 50 51 while ( true ) 52 { 53 string directory = ServerMapFolder(sResourceType, "/"); 54 string sFilePath = System.IO.Path.Combine(directory, sFileName); 55 56 if ( System.IO.File.Exists( sFilePath ) ) 57 { 58 iCounter++ ; 59 sFileName = 60 System.IO.Path.GetFileNameWithoutExtension( oFile.FileName ) + 61 "(" + iCounter + ")" + 62 System.IO.Path.GetExtension( oFile.FileName ) ; 63 64 iErrorNumber = 201 ; 65 } 66 else 67 { 68 oFile.SaveAs( sFilePath ) ; 69 oFile = null; 70 71 //pageId is used to enforce a secure download of the image with authentication of the user 72 // [XXX] will be replaced by the pageId when saving the data in HtmlContent.ascx.cs 73 string pageId = "[XXX]"; 74 75 sFileUrl = ResolveUrl("~/ImageHandler.ashx?UploadedFile=true&pg=" + pageId + "&image=" + this.UserFilesPath + sResourceType + "/" + sFileName); 76 break ; 77 } 78 } 79 80 SendResults( iErrorNumber, sFileUrl, sFileName ) ; 81 } 82 83 SendResults Method 129 } 130} 131
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:MyWebPages51aspx汉化最终版
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号