ASP upload

zhaozj2021-02-16  50

<% 'Judging whether the file DIM ULFILENAME, ULRESULT

Ulsavetopath = "/ upload" 'Save File Path ULMAXFILESIZE = 1000000' File Size limit 1000,000

UlResult = douploadFile (ulmaxfilesize, ulfilename)

Function DouploadFile (MAXUPLOADSIZE, FILENAME) DIM UPLOAD, FILE, FORMNAME, FORMPATH, FILEEXT FORMNAME = "" SET UPLOAD = New Upload_yfly 'Established Upload Objects

IF IsNull (Upload.File) THEN DoUploadFile = 6 EXIT Function END IF IF Upload.File.Count = 0 Then DoUploadFile = 5 'No File uploaded Else Set File = Upload.File ( "ulFileToUpload") If File.FileName = "" THEN DOUPLOADED ELSE 'Upload file is not empty to process upload' after the directory (/) FormPath = UPLOAD.FORM ("UlsaveFilePath") IF Right (FormPath, 1) <> "/" THEN FORMPATH = FormPath & "/" end if fix.filesize <100 Then DouploadFile = 1 'file size too small exit function end if fix.filesize> maxUploadsize the douploadfile = 2' file size exceeded EXIT function end if fixedext = LCase (Right (file.filename, 4)) UPLOADSUC = false if not (fileext = ".gif" OR fileext = ".jpg") The dolploadFile = 3 'file format incorrect EXIT FUNCTION END I fly

Randomize Rannum = INT (90000 * RND) 10000 'File Name FileName = FormPath & Year (NOW) & Month (Now) & Second (NOW) & SECOND (NOW) & Rannum & FileExt if file.filesize> 0 Then '' If FileSize> 0 Description has file data file.saveas server.mappath (filename) '' save file end if douploadFile = 0 end if set file = Nothing end if set upload = nothing 'Delete This object end function%>