function | Serial number | function | Serial number <% ' The current date and time into the serial number
function Makefilename (fname)
FName = Now ()
fname = replace (fname, "-", "")
fname = replace (fname, "", "")
fname = replace (fname, ":", "")
fname = replace (fname, "PM", "")
fname = replace (fname, "AM", "")
fname = replace (fname, "a.m.", "")
fname = replace (fname, "PM", "")
Makefilename=fname
End Function
%>
On the function body, you can use this sentence vfname=makefilename (now ()) to invoke the current time call.
If Response.Write Vfname is displayed: Month and year day.
If the virtual upload to get the type of file uploaded, you can use the following function
<%
function Getextendname (FileName)
Dim extname
Extname = LCase (FileName)
Extname = Right (extname,3)
Extname = Right (Extname,3-instr (Extname, "."))
Getextendname = Extname
End Function
%>
This approach can be used when using function InStr to perform a comparison of uploaded file types
If Instr (". Gif.jpg.png", Getextendname) (file. FileName)) Then ' limits the type of upload file
' Typeflag = 1 ' file is a permitted type
Vfname = Makefilename (now ()) file performs this row for the allowed type
Fname=vfname & "." & Getextendname (file. FileName)
File. SaveAs Server.MapPath (upfilepath&fname) ' Save file
Else
' Typeflag = 0 ' file is not a permitted type
Response.Write ("<script language=javascript>")
Response.Write (' Alert (' does not support the type of file you are uploading! '); "
Response.Write ("History.back ();")
Response.Write ("</script>")
End If