% 'response.write request.Form("saveTemplate") 'response.End() if request.form("saveTemplate")="yes" then TemplateFolder = trim(request.form("TemplateFolder")) if right(TemplateFolder,1)<>"/" then TemplateFolder = TemplateFolder & "/" set Fs = server.CreateObject("Scripting.FileSystemObject") TemplatePath = getUniqueFileName( TemplateFolder & request.Form("savename") ) ImageName = TemplatePath & ".gif" SourceImage = "Custom.gif" TemplatePath = TemplatePath & ".html" set myFile = Fs.OpenTextFile(server.MapPath(TemplatePath),2,true) myFile.write( request.Form("editorContent") ) myFile.close Fs.CopyFile server.MapPath(SourceImage), server.MapPath(ImageName) set Fs = nothing %> <% response.End() end if function getUniqueFileName(FilePath) newFilePath = FilePath if request.Form("overwrite")="" then n = -1 while Fs.FileExists(server.MapPath(newFilePath & ".html")) n = n + 1 newFilePath = FilePath & "(" & cstr(n) & ")" wend end if getUniqueFileName = newFilePath end function %>