Processing file upload and delete custom functions
<%'''''''''''''''''''''''''''''''''''''''''''''''' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'function DeleteFile (Filename)' to delete the file if Filename <> "" then Set fso = server.CreateObject ( "Scripting.FileSystemObject") if fso.FileExists (Filename) then fso.DeleteFile Filename end if set fso = nothing end ifend function'''''''''''''''''''''''''''''''''''''''''''''''' '' '' '' '' '' '' '' '' '' '' Function CreateDir (BYVAL LOCALPATH) 'Establishing the program of the directory, if there is a multi-level directory, the first-level level creation ON error resume next LocalPath = replace (LocalPath, "/", "/") set FileObject = server.createobject ( "Scripting.FileSystemObject") patharr = split (LocalPath, "/") path_level = ubound (patharr) for i = 0 TO PATH_LEVEL IF I = 0 THEN PATHTMP = Patharr (0) &
"/" Else pathtmp = pathtmp & patharr (i) & "/" cpath = left (pathtmp, len (pathtmp) -1) if not FileObject.FolderExists (cpath) then FileObject.CreateFolder cpath next set FileObject = nothing if err. Number <> 0 THEN CREATEDIR = false err.clear else createdir = true end ifend function '' '' '' '' '' '' '' '' '' '' '' '' ' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'Function SaverandFileName (Byval SzFileName) This is based on the original file name. Generate new random file name Randomize 'rannu = int (90000 * rND) 10000' if Month (now) <10 TEN C_MONTH = "0" & month (now) Else c_month = month (now) 'if day (now) <10 THEN C_DAY = "0" & day (now) else c_day = day (now) 'IF HOUR (NOW) <10 TEN C_HOUR = "0" & HOUR (NOW) ELSE C_HOUR = HOUR (NOW)' IF Minute ( NOW) <10 THEN C_MINUTE = "0" & minute (now) Else C_Minute = Minute (NOW) 'IF Second (now) <10 THEN C_SECOND = "0" & Second (Now) Else C_Second = Minute (now) fileExt_a = Split (SZFileName, ".) fileext = lcase (fileext_a)) SaverandFileName = Replace (Replace (now,": ",", ",", ",", ",", " ") & int (10 * rND) &". "& fileext 'generatingrandomfilen AME = Year (now) & c_month & c_day & c_Hour & C_Minute & c_second & "_" & rannum & "." & fileextend function '' '
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'Function Jaron_replace (strcontent, start_string, end_string, replace_string)' CMS Replacement function: Source string, front part, back part, replaceable character 'Return after the string is replaced jaron_replacer = replace (strContent, mid (strContent, instr (strContent, start_string), instr (strContent, end_string) len (end_string) -1), replace_string) end function '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' function replaceplus (strContent, start_string, end_string, replace_string) 'document, will all start, all the characters between the end of the deletion on error resume nextMARKCOUNTS = ubound (split (strContent , start_string)) PRESTRING = strContentfor i = 0 to MARKCOUNTSSTARTMARK = instr (1, PRESTRING, start_string, 1) if STARTMARK = 0 then exit forCOMPMARK = instr (1, PRESTRING, end_string, 1) len (end_string) verString = mid ( PRESTRING, STARTMARK, COMPMARK - STARTMARK) PRESTRING = replace (PRESTRING, verString, replace_string) nextreplaceplus = PRESTRINGif err.number <> 0 then err.Clearend function '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''