我做asp程序时加kindeditor-4.1.5文本编辑器,上传图片不好用

传图片这种状况<%'KindEditorASPDimaspUrl,savePath,saveUrl,maxSize,fileName,fileExt,newFileNam... 传图片这种状况

<%
' KindEditor ASP
Dim aspUrl, savePath, saveUrl, maxSize, fileName, fileExt, newFileName, filePath, fileUrl, dirName Dim extStr, imageExtStr, flashExtStr, mediaExtStr, fileExtStr
Dim upload, file, fso, ranNum, hash, ymd, mm, dd, result
aspUrl = Request.ServerVariables("SCRIPT_NAME")aspUrl = left(aspUrl, InStrRev(aspUrl, "/"))
'文件保存目录路径 savePath = "../attached/"
'文件保存目录URL
saveUrl = aspUrl & "../attached/"
'定义允许上传的文件扩展名
imageExtStr = "gif|jpg|jpeg|png|bmp"
flashExtStr = "swf|flv"
mediaExtStr = "swf|flv|mp3|wav|wma|wmv|mid|avi|mpg|asf|rm|rmvb"
fileExtStr = "doc|docx|xls|xlsx|ppt|htm|html|txt|zip|rar|gz|bz2"
'最大文件大小
maxSize = 5 * 1024 * 1024 '5M
Set fso = Server.CreateObject("Scripting.FileSystemObject") If Not fso.FolderExists(Server.mappath(savePath)) Then
showError("上传目录不存在。")
End If
dirName = Request.QueryString("dir") If isEmpty(dirName) Then
dirName = "image"
End If
If instr(lcase("image,flash,media,file"), dirName) < 1 Then
showError("目录名不正确。")
End If
Select Case dirName Case "flash" extStr = flashExtStr
Case "media" extStr = mediaExtStr
Case "file" extStr = fileExtStr
Case Else extStr = imageExtStr
End Select
set upload = new AnUpLoad upload.Exe = extStr
upload.MaxSize = maxSize
upload.GetData()
if upload.ErrorID>0 then
showError(upload.Description)
end if
'创建文件夹 savePath = savePath & dirName & "/"
saveUrl = saveUrl & dirName & "/"
If Not fso.FolderExists(Server.mappath(savePath)) Then
fso.CreateFolder(Server.mappath(savePath))
End If
mm = month(now)
If mm < 10 Then
mm = "0" & mm
End If
dd = day(now)
If dd < 10 Then
dd = "0" & dd
End If
ymd = year(now) & mm & dd
savePath = savePath & ymd & "/"
saveUrl = saveUrl & ymd & "/"
If Not fso.FolderExists(Server.mappath(savePath)) Then
fso.CreateFolder(Server.mappath(savePath))
End If
set file = upload.files("imgFile") if file is nothing then
showError("请选择文件。")
end if
set result = file.saveToFile(savePath, 0, true) if result.error then
showError(file.Exception)
end if
filePath = Server.mappath(savePath & file.filename)fileUrl = saveUrl & file.filename
Set upload = nothingSet file = nothing
If Not fso.FileExists(filePath) Then showError("上传文件失败。")
End If
Response.AddHeader "Content-Type", "text/html; charset=UTF-8" Set hash = jsObject()
hash("error") = 0
hash("url") = fileUrl
hash.Flush
Response.End
Function showError(message) Response.AddHeader "Content-Type", "text/html; charset=UTF-8"
Dim hash
Set hash = jsObject()
hash("error") = 1
hash("message") = message
hash.Flush
Response.End
End Function
%>
怎么改谢谢大家,我的qq326226328
展开
 我来答
启智思维
2013-02-01 · TA获得超过3416个赞
知道小有建树答主
回答量:1578
采纳率:0%
帮助的人:666万
展开全部
我倒是用过Kindeditor,还是比较容易配置的。
更多追问追答
追问
那帮我看看怎么配置呗,我没配置上呀!谢谢你
追答
好用了没有啊??
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式