I would like to use nicedit
image upload with classic asp. By default Nicedit uploads images to ImageShack, but I would like to send images to my server. However I'm having trouble to adapt some features of the original PHP script to classic asp. I found this script that uploads the image and returns the image info in javascript format and generates a progress bar.
<script>
try{
top.nicUploadButton.statusCb({'done':1,'url':'$link','width':30});
}
catch(e) {
alert(e.message);
}
</script>
PHP has built-in functions that provide a progress bar and I have difficulties setting up a progress bar in vbscript.
Could someone guide me on what should be implemented so that the basic functions of this script remain in the asp version? Thanks.
==UPDATE==
I made the upload script that is working well, but I need help to make the progress bar. I usually use the jQuery progress bar inside a loop but would like to help in order to make it work during this upload process.
<%
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
%>