' 保存操作
Sub DoSave()
Dim oUpload, oFile, sFileExt, sSourceFileName, sSaveFileName
' 建立上传对象
Set oUpload = New upfile_class
' 取得上传数据,限制最大上传
oUpload.GetData(nAllowSize*50240)
If oUpload.Err > 0 Then
Select Case oUpload.Err
Case 1
Call OutScript("parent.UploadError('请选择有效的上传文件!')")
Case 2
Call OutScript("parent.UploadError('你上传的文件总大小超出了最大限制(" & nAllowSize*50240 & "KB)!')")
End Select
Response.End
End If
' 输出客户端脚本
Sub OutScript(str)
Response.Write "<script language=javascript>" & str & ";history.back()</script>"
End Sub
' 检测扩展名的有效性
Sub CheckValidExt(sExt)
Dim b, i, aExt
b = False
aExt = Split(sAllowExt, "|")
For i = 0 To UBound(aExt)
If LCase(aExt(i)) = sExt Then
b = True
Exit For
End If
Next
If b = False Then
OutScript("parent.UploadError('提示:\n\n请选择一个有效的文件,\n支持的格式有("+sAllowExt+")!')")
Response.End
End If
End Sub
' 初始化上传限制数据
Sub InitUpload()
sType = UCase(Trim(Request.QueryString("type")))
sStyleName = Trim(Request.QueryString("style"))
sSql = "select * from ewebeditor_style where s_name='" & sStyleName & "'"
oRs.Open sSql, oConn, 0, 1
If Not oRs.Eof Then
sUploadDir = oRs("S_UploadDir")
sUploadDir = Replace(sUploadDir, "\", "/")
If Right(sUploadDir, 1) <> "/" Then
sUploadDir = sUploadDir & "/"
End If
Select Case sType
Case "FILE"
sAllowExt = oRs("S_FileExt")
nAllowSize = oRs("S_FileSize")
Case "MEDIA"
sAllowExt = oRs("S_MediaExt")
nAllowSize = oRs("S_MediaSize")
Case "FLASH"
sAllowExt = oRs("S_FlashExt")
nAllowSize = oRs("S_FlashSize")
Case Else
sAllowExt = oRs("S_ImageExt")
nAllowSize = oRs("S_ImageSize")
End Select
Else
OutScript("parent.UploadError('无效的样式ID号,请通过页面上的链接进行操作!')")
End If
oRs.Close
' 任何情况下都不允许上传asp脚本文件
sAllowExt = Replace(UCase(sAllowExt), "ASP", "")
sAllowExt = Replace(UCase(sAllowExt), "asa", "")
End Sub
%>作者: popowen 时间: 2012-4-8 19:57
怎么这么复杂的,弄得~~