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

FCKeditor限制上传的Upload修改,请高手给点帮助
网站用了FCKeditor安全修正版,限制了文件类型,但是才发现不能限制插入图片的尺寸和大小,总被人发超大的图片撑开版式或者大容量的图片浪费空间。看了看,大概是要在Uploader.cs文件中加限制,我现在才刚开始学C#,一时半会实在改不了,希望有好心的朋友帮帮我,应个急,谢谢了。

希望能加上对图片尺寸限制在宽度500以下,图片大小在150K以内。


现在的Uploader.cs代码如下------------------------------------


using   System;
using   System.Globalization;
using   System.Xml;
using   System.Web;

namespace   FredCK.FCKeditorV2
{
        public   class   Uploader   :   FileWorkerBase
        {
                protected   override   void   OnLoad(EventArgs   e)
                {
                        //   Get   the   posted   file.
                        HttpPostedFile   oFile   =   Request.Files[ "NewFile "];

                        //   Check   if   the   file   has   been   correctly   uploaded
                        if   (oFile   ==   null   ||   oFile.ContentLength   ==   0)
                        {
                                SendResults(202);
                                return;
                        }

                        int   iErrorNumber   =   0;
                        string   sFileUrl   =   " ";

                        //   Get   the   uploaded   file   name.
                        string   sFileName   =   System.IO.Path.GetFileName(oFile.FileName);

                        int   iCounter   =   0;

                        while   (true)
                        {
                                //判断文件是否可以上传
                                if   (CheckUploadFileExtension(sFileName))
                                {
                                        string   sFilePath   =   System.IO.Path.Combine(this.UserFilesDirectory,   sFileName);

          &n