ASP use the FSO to generate HTML pages, this article is my sophomore wrote, is the use of the ASP with the component FSO to upload the user files on the production of HTML files used, it is also a good judge of the existence of the file name, and so on
<%
Dim Path,filename,filetype,fileconten,fso
Path=request ("path")
Filename=html_encode (Request ("filename"))
Filecontent=request ("Filecontent")
Filetype=request ("filetype")
If InStr (FileName, "*") >0 or InStr (filename, "?") >0 or InStr (filename, "&") >0 or len (filename) <0 or filename= "" Then
Response. Write ("<script language= ' JavaScript ' >alert (' illegal filename! '); History.back ();</script> ")
Response.End
Else
Set Fso=server.createobject ("Scripting.FileSystemObject")
If Fso.fileexists (Path&filename&filetype) Then
Response. Write ("<script language= ' JavaScript" >alert (' filename has been saved, please choose again! '); History.back ();</script> ")
Response. End ()
End If
Set Input=fso.createtextfile (Server.MapPath (Path&filename&filetype), true)
Input.writeline (filecontent)
Input.close
If Err Then
Response. Write (' <script language= ' JavaScript ' >alert (' unexpected error! ' Save file failed! '); History.back ();</script> ")
Else
%>
<script language= "" >
var pathh= "<%=replace" (Session ("ScriptName"), "", "/")%> ";
Alert ("File success!");
window.location= "Try/mange_page.asp?pathh=" +PATHH;
</script>
<%
End If
End If
%>
Original: Www.111cn.net Turn please specify