ASP uses FSO to generate HTML pages

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.