关于ewebeditor上传图片时等待中...在线等
我现在在本地做了一个ewebeditor,但是在点击上传图片按钮时,老是提示在等待中...请稍后...,我登录5分钟都是这样子的,而且我图片只有2K左右,我到网上查了下说是路径不对,想问下我应该怎么设置路径了?项目路径结构:IOEB.Manager.Web
--Properties
--引用
--App_Code
--EWEBEDITOR
--_example
--admin
--asp
--config.asp
--upfileclass.asp
--upload.asp
--.....
--uploadfile
upload.asp文件如下:
Server.ScriptTimeOut = 1800
Dim sType, sStyleName, sCusDir, sParamSYFlag
Dim sAllowExt, nAllowSize, sUploadDir, nUploadObject, nAutoDir, sBaseUrl, sContentPath
Dim sFileExt, sOriginalFileName, sSaveFileName, sPathFileName, nFileNum
Dim nSLTFlag, nSLTMinSize, nSLTOkSize, nSYWZFlag, sSYText, sSYFontColor, nSYFontSize, sSYFontName, sSYPicPath, nSLTSYObject, sSLTSYExt, nSYWZMinWidth, sSYShadowColor, nSYShadowOffset, nSYWZMinHeight, nSYWZPosition, nSYWZTextWidth, nSYWZTextHeight, nSYWZPaddingH, nSYWZPaddingV, nSYTPFlag, nSYTPMinWidth, nSYTPMinHeight, nSYTPPosition, nSYTPPaddingH, nSYTPPaddingV, nSYTPImageWidth, nSYTPImageHeight, nSYTPOpacity, nCusDirFlag
Call InitUpload()
Dim sAction
sAction = UCase(Trim(Request.QueryString("action")))
Call DoCreateNewDir()
Select Case sAction
Case "LOCAL"
Call DoLocal()
Case "REMOTE"
Call DoRemote()
Case "SAVE"
Call DoSave()
End Select
Sub DoSave()
Response.Write "<html><head><title>eWebEditor</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'></head><body>"
Select Case nUploadObject
Case 1
Call DoUpload_ASPUpload()
Case 2
Call DoUpload_SAFileUP()
Case 3
Call DoUpload_LyfUpload()
Case Else
Call DoUpload_Class()
End Select
Dim s_SmallImageFile, s_SmallImagePathFile, s_SmallImageScript
s_SmallImageFile = getSmallImageFile(sSaveFileName)
s_SmallImagePathFile = ""
s_SmallImageScript = ""
If makeImageSLT(sUploadDir, sSaveFileName, s_SmallImageFile) = True Then
Call makeImageSY(sUploadDir, s_SmallImageFile)
Call makeImageSY(sUploadDir, sSaveFileName)
s_SmallImagePathFile = sContentPath & s_SmallImageFile
s_SmallImageScript = "try{obj.addUploadFile('" & sOriginalFileName & "', '" & s_SmallImageFile & "', '" & s_SmallImagePathFile & "');} catch(e){} "
Else
s_SmallImageFile = ""
Call makeImageSY(sUploadDir, sSaveFileName)
End If
sPathFileName = sContentPath & sSaveFileName
sOriginalFileName = Replace(sOriginalFileName, "'", "\'")
sOriginalFileName = Replace(sOriginalFileName, """", "\""")
Call OutScript("parent.UploadSaved('" & sPathFileName & "','" & s_SmallImagePathFile & "');var obj=parent.dialogArguments;if((!obj.eWebEditor)||(!obj.eWebEditor_Temp_HTML)||(!obj.eWebEditor_UploadForm)){obj=parent.dialogArguments.dialogArguments;} try{obj.addUploadFile('" & sOriginalFileName & "', '" & sSaveFileName & "', '" & sPathFileName & "');} catch(e){} " & s_SmallImageScript)
End Sub
Sub DoLocal()
Select Case nUploadObject
Case 1
Call DoUpload_ASPUpload()
Case 2
Call DoUpload_SAFileUP()
Case 3
Call DoUpload_LyfUpload()
Case Else
Call DoUpload_Class()
End Select
sPathFileName = sContentPath & sSaveFileName
Response.Write sPathFileName
End Sub
Sub makeImageSY(s_Path, s_File)
If nSYWZFlag = 0 And nSYTPFlag = 0 Then Exit Sub
If isValidSLTSYExt(s_File) = False Then Exit Sub
On Error Resume Next
Dim nOriginalWidth, nOriginalHeight, posX, posY
Dim oImage, oLogo
Select Case nSLTSYObject
Case 0
If IsObjInstalled("Persits.Jpeg") = False Then Exit Sub
Set oImage = Server.CreateObject("Persits.Jpeg")
If nSYWZFlag = 1 Then
oImage.Open (s_Path & s_File)
nOriginalWidth = oImage.OriginalWidth
nOriginalHeight = oImage.OriginalHeight
If nOriginalWidth<nSYWZMinWidth Or nOriginalHeight<nSYWZMinHeight Then Exit Sub
posX = getSYPosX(nSYWZPosition, nOriginalWidth, nSYWZTextWidth+nSYShadowOffset, nSYWZPaddingH)
posY = getSYPosY(nSYWZPosition, nOriginalHeight, nSYWZTextHeight+nSYShadowOffset, nSYWZPaddingV)
oImage.Canvas.Font.Color = Clng("&H" & sSYFontColor)
oImage.Canvas.Font.Family = sSYFontName
oImage.Canvas.Font.Size = nSYFontSize
oImage.Canvas.Font.ShadowColor = Clng("&H" & sSYShadowColor)
oImage.Canvas.Font.ShadowXOffset = nSYShadowOffset
oImage.Canvas.Font.ShadowYOffset = nSYShadowOffset
oImage.Canvas.Print posX, posY, sSYText
oImage.Save (s_Path & s_File)
End If
If nSYTPFlag = 1 Then
oImage.Open (s_Path & s_File)
nOriginalWidth = oImage.OriginalWidth
nOriginalHeight = oImage.OriginalHeight
If nOriginalWidth<nSYTPMinWidth Or nOriginalHeight<nSYTPMinHeight Then Exit Sub
posX = getSYPosX(nSYTPPosition, nOriginalWidth, nSYTPImageWidth, nSYTPPaddingH)
posY = getSYPosY(nSYTPPosition, nOriginalHeight, nSYTPImageHeight, nSYTPPaddingV)
Set oLogo = Server.CreateObject("Persits.Jpeg")
oLogo.Open Server.Mappath(sSYPicPath)
oImage.DrawImage posX, posY, oLogo, nSYTPOpacity, &HFFFFFF
oImage.Save (s_Path & s_File)
Set oLogo = Nothing
End If
Set oImage = Nothing
Case Else
End Select
End Sub
Function getSYPosX(posFlag, originalW, syW, paddingH)
Select Case posFlag
Case 1, 2, 3
getSYPosX = paddingH
Case 4, 5, 6
getSYPosX = (originalW - syW) \ 2
Case 7, 8, 9
getSYPosX = originalW - paddingH - syW
End Select
End Function
Function getSYPosY(posFlag, originalH, syH, paddingV)
Select Case posFlag
Case 1, 4, 7
getSYPosY = paddingV
Case 2, 5, 8
getSYPosY = (originalH - syH) \ 2
Case 3, 6, 9
getSYPosY = originalH - paddingV - syH
End Select
End Function
Function makeImageSLT(s_Path, s_File, s_SmallFile)
makeImageSLT = False
If nSLTFlag = 0 Then Exit Function
If isValidSLTSYExt(s_File) = False Then Exit Function
Dim nOriginalWidth, nOriginalHeight, nWidth, nHeight
Dim oImage
Select Case nSLTSYObject
Case 0
If IsObjInstalled("Persits.Jpeg") = False Then Exit Function
Set oImage = Server.CreateObject("Persits.Jpeg")
oImage.Open (s_Path & s_File)
nOriginalWidth = oImage.OriginalWidth
nOriginalHeight = oImage.OriginalHeight
If nOriginalWidth < nSLTMinSize And nOriginalHeight < nSLTMinSize Then Exit Function
If nOriginalWidth > nOriginalHeight Then
nWidth = nSLTOkSize
nHeight = (nSLTOkSize / nOriginalWidth) * nOriginalHeight
Else
nHeight = nSLTOkSize
nWidth = (nSLTOkSize / nOriginalHeight) * nOriginalWidth
End If
oImage.Width = nWidth
oImage.Height = nHeight
oImage.Save (s_Path & s_SmallFile)
Set oImage = Nothing
Case Else
End Select
makeImageSLT = True
End Function
Function isValidSLTSYExt(s_File)
Dim b, i, aExt, sExt
b = False
sExt = LCase(Mid(s_File, InstrRev(s_File, ".")+1))
aExt = Split(LCase(sSLTSYExt), "|")
For i = 0 To UBound(aExt)
If aExt(i) = sExt Then
b = True
Exit For
End If
Next
isValidSLTSYExt = b
End Function
Function getSmallImageFile(s_File)
Dim n
n = InstrRev(s_File, ".")
getSmallImageFile = Left(s_File, n-1) & "_s." & Mid(s_File, n+1)
End Function
Sub DoRemote()
Dim sContent, i
For i = 1 To Request.Form("eWebEditor_UploadText").Count
sContent = sContent & Request.Form("eWebEditor_UploadText")(i)
Next
If sAllowExt <> "" Then
sContent = ReplaceRemoteUrl(sContent, sAllowExt)
End If
Response.Write "<html><head><title>eWebEditor</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'></head><body>" & _
"<input type=hidden id=UploadText value=""" & inHTML(sContent) & """>" & _
"</body></html>"
Call OutScriptNoBack("parent.setHTML(UploadText.value);try{parent.addUploadFile('" & sOriginalFileName & "', '" & sSaveFileName & "', '" & sPathFileName & "');} catch(e){} parent.remoteUploadOK();")
End Sub
Sub DoCreateNewDir()
Dim a, i
If nCusDirFlag = 1 Then
a = Split(sCusDir, "/")
For i = 0 To UBound(a)
If a(i) <> "" Then
Call CreateFolder(a(i))
End If
Next
End If
Dim s_DateDir
Select Case nAutoDir
Case 1
s_DateDir = Left(FormatTime(Now(), 4), 4)
Case 2
s_DateDir = Left(FormatTime(Now(), 4), 6)
Case 3
s_DateDir = Left(FormatTime(Now(), 4), 8)
Case Else
s_DateDir = ""
End Select
If s_DateDir <> "" Then
Call CreateFolder(s_DateDir)
End If
End Sub
Sub CreateFolder(s_Folder)
If IsObjInstalled("Scripting.FileSystemObject") = False Then
Exit Sub
End If
sUploadDir = sUploadDir & s_Folder & "\"
sContentPath = sContentPath & s_Folder & "/"
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(sUploadDir) = False Then
fso.CreateFolder sUploadDir
End If
Set fso = Nothing
End Sub
Sub DoUpload_LyfUpload()
On Error Resume Next
Dim oUpload, sResult, sOriginalFile
Set oUpload = Server.CreateObject("LyfUpload.UploadFile")
oUpload.CodePage = 936
oUpload.ExtName = Replace(sAllowExt, "|", ",")
oUpload.MaxSize = nAllowSize*1024
sOriginalFile = oUpload.Request("originalfile")
sOriginalFileName = Mid(sOriginalFile, InStrRev(sOriginalFile, "\") + 1)
sFileExt = LCase(Mid(sOriginalFileName, InStrRev(sOriginalFileName, ".") + 1))
Call CheckValidExt(sFileExt)
sSaveFileName = GetRndFileName(sFileExt)
...................... --------------------编程问答-------------------- 好长。。。帮顶~ --------------------编程问答-------------------- 服务器文件夹权限
参考 --------------------编程问答-------------------- asp ? --------------------编程问答-------------------- 编辑器不能上传的两点经验解决方法:
有时我们常遇到在编辑器上传图片的时候出现“。。。上传图片。。。请稍候。。。”
解决方法1:出现这个问题的是因为上传的目的文件夹(uploadfile)没有权限,这样,只要对目的文件夹给个权限就可以了。
右击uploadfile->属性->安全->添加->输入“everyone”,在下面的允许的权限全部勾上,确定就可以了。
解决方法2:这个问题也有可以是服务器没有设置“开启父目录”,因没有允许访问“../”类型的文件夹,编辑器的保存路径又是以“../”开头,如“../WebEditor/uploadfile”,如果没有开启父目录,那么上传的时候,编辑器就不能访问保存路径,所以就会出现问题。这样只要到服务器(如:IIS)中开启父目录就可以了。
右击网站->属性->主目录->配置->选项->勾开“启用父路径”,确定就可以了。
补充:.NET技术 , ASP.NET