我想将nicedit
图像上传与经典 asp 一起使用。默认情况下 Nicedit 将图像上传到 ImageShack,但我想将图像发送到我的服务器。但是,我在将原始 PHP 脚本的某些功能调整为经典 asp 时遇到了麻烦。我发现这个脚本可以上传图像并以 javascript 格式返回图像信息并生成进度条。
<script>
try{
top.nicUploadButton.statusCb({'done':1,'url':'$link','width':30});
}
catch(e) {
alert(e.message);
}
</script>
PHP 具有提供进度条的内置函数,我在 vbscript 中设置进度条时遇到困难。
有人可以指导我应该实现什么,以便该脚本的基本功能保留在 asp 版本中吗?谢谢。
==更新==
我制作了运行良好的上传脚本,但我需要帮助来制作进度条。我通常在循环中使用 jQuery 进度条,但希望在此上传过程中提供帮助以使其正常工作。
<%
Server.ScriptTimeout = 26000
UplMaxSize = 1048576
sExtL = "jpg,jpeg,png,gif,bmp"
Set Upload = Server.CreateObject("Persits.Upload")
Upload.OverwriteFiles = True
Upload.SetMaxSize UplMaxSize, True
nCount = Upload.Save
If nCount > 0 Then
Set File = Upload.Files(1)
sFileName = File.FileName
sWidth = File.ImageWidth
If Err.Number = 8 Then
Set uplresult = jsObject()
uplresult("error") = "O tamanho do arquivo excedeu o limite!"
uplresult.Flush ' estampa json
Response.End()
End If
If Not File Is Nothing Then
' Save the file to the file system
sPath = Server.MapPath(".\public\upimages")
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
sExt = oFSO.GetExtensionName(sPath & sFileName)
If Not (InStr(sExtL,sExt) > 0) Then
Set uplresult = jsObject()
uplresult("error") = "Extensão de arquivo inválida!"
uplresult.Flush ' estampa json
Response.End()
End If
File.SaveAs sPath & "\" & sFileName
Response.Write("<script>try {top.nicUploadButton.statusCb({'done':1,'url':'/blog/public/upimages/" & sFileName & "','width':" & sWidth & "});} catch(e) {alert(e.message);}</script>")
End If
End If
%>