Use the current date as the serial number and use the function

Source: Internet
Author: User
Tags current time
<% '': Convert the current date and time to 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, "morning ","")
Fname = replace (fname, "afternoon ","")
Makefilename = fname
End function
You can use this statement vfname = makefilename (now () to call the current time,
If response. write vfname is set, it is displayed as "year", "month", and "day.
If the type of the uploaded file is obtained during virtual Upload, 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
You can use this method to compare the types of uploaded files by using the instr function.
If Instr (".gif.jpg.png", GetExtendName (file. FileName) then' limits the Upload file type
The 'typeflag = 1' file is of the allowed type.
Vfname = makefilename (now () 'file is allowed type to execute this line
Fname = vfname & "." & GetExtendName (file. FileName)
File. SaveAs Server. mappath (UpFilePath & fname) ''save the file
'Typeflag = 0' file type is not allowed
Response. write ("<script language = javascript> ")
Response. write ("alert ('does not support the file type you uploaded! ');")
Response. write ("history. back ();")
Response. write ("</script> ")
End if

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.