(1)定義其允許上傳的最大(dà)值。
這個是在fckeditor\editor\filemanager\connectors\asp\config.asp中(zhōng)修改的。在文件的最後添加如下(xià)代碼:
ASP/Visual Basic代碼
- Dim LinkUploadLimit,ImageUploadLimit,FlashUploadLimit,AttachUploadLimit,MediaUploadLimit
- Dim LinkUploadMaxsize,ImageUploadMaxsize,FlashUploadMaxsize,AttachUploadMaxsize,MediaUploadMaxsize
-
- LinkUploadLimit = True
- LinkUploadMaxsize = 1024
-
- ImageUploadLimit = True
- ImageUploadMaxsize = 2048
-
- FlashUploadLimit = True
- FlashUploadMaxsize = 2048
-
- MediaUploadLimit = True
- MediaUploadMaxsize = 2048
-
- AttachUploadLimit = True
- AttachUploadMaxsize = 2048
FckEditor針對不同的上傳方式将上傳文件分(fēn)爲link,Image,Flash,Media等類型(Attach類型爲我(wǒ)添加的),分(fēn)别對應Fckeditor工(gōng)具欄上各個按鈕的上傳,如link對應使用超鏈接按鈕創建超鏈接時上傳的文件。因此這裏對每種類型定義了兩個變量一(yī)個用來設定是否開(kāi)啓上傳限制,一(yī)個是上傳的最大(dà)值,單位爲k。
(2)判斷上傳的文件是否超過限制。
這個是在fckeditor\editor\filemanager\connectors\asp\commands.asp中(zhōng)修改的。
在172行之後即語句sOriginalFileName = sFileName之後添加如下(xià)代碼
ASP/Visual Basic代碼
-
- Dim dFileSize,UploadLimitMaxsize,IsUploadLimit,IsLimitOk
-
-
- dFileSize=oUploader.File( "NewFile" ).Size/1024
-
- select case sResourceType
- case "File"
- IsUpLoadLimit=LinkUploadLimit
- UploadLimitMaxsize=LinkUploadMaxsize
- case "Image"
- IsUpLoadLimit=ImageUploadLimit
- UploadLimitMaxsize=ImageUploadMaxsize
- case "Flash"
- IsUpLoadLimit=FlashUploadLimit
- UploadLimitMaxsize=FlashUploadMaxsize
- case "Media"
- IsUpLoadLimit=MediaUploadLimit
- UploadLimitMaxsize=MediaUploadMaxsize
- case "Attach"
- IsUpLoadLimit=AttachUploadLimit
- UploadLimitMaxsize=AttachUploadMaxsize
-
- case else
-
- IsUploadLimit=True
- UploadLimitMaxsize=102400
- end select
-
-
- IsLimitOk=False
- if IsUploadLimit then
- if dFileSize > UploadLimitMaxsize then
- IsLimitOk = True
- sErrorNumber = "204"
- end if
- end if
-
修改172行後的 DO While ……loop語句
Do While ( True )改爲 Do While ( not IsLimitOk )
(3)定義客戶端的錯誤提示信息。
客戶端錯誤提示信息在每一(yī)類上傳(如 link、image)對應的文件夾中(zhōng)的js文件中(zhōng)修改。
link:在fckeditor\editor\dialog\fck_link\下(xià)的fck_link.js中(zhōng)修改
修改函數function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )中(zhōng)的switch …case 語句
即下(xià)列語句之後
case 203 :
alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
r
文章整理:
世紀雲圖 https://www.yuntop.cc/
以上信息與文章正文是不可分(fēn)割的一(yī)部分(fēn),如果您要轉載本文章,請保留以上信息,謝謝!
版權申明:本站文章部份來自網絡,如有侵權,請聯系我(wǒ)們,我(wǒ)們收到後立即删除,謝謝!
特别注意:本站部份轉載文章言論不代表本站觀點,本站所提供的攝影照片,插畫,設計作品,如需使用,請與原作者聯系,版權歸原作者所有。