温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:MyWebPages51aspx汉化最终版
当前文件:
MyWebPagesStarterKit/App_Code/FCKEditor/Uploader.cs,打开代码结构图
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
20
using System ; 21
using System.Globalization ; 22
using System.Xml ; 23
using System.Web ; 24
using System.IO; 25
26
namespace 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



* FCKeditor - The text editor for internet

}