An instance of an ASP unbleached upload

zhaozj2021-02-16  54

<% 'Determines whether to add a file Dim ulFileName, ulResult ulSaveToPath = "/ upload"' Save File Path ulMaxFileSize = 1000000 'file size limit of 1000,000 ulResult = DoUploadFile (ulMaxFileSize, ulFileName) Function DoUploadFile (MaxUpLoadSize, FileName) Dim Upload, File, formName, formPath, FileExt FileName = "" 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 = "" "The DouploadFile = 4 'no file uploaded else' Upload file is not empty, handle the upload 'after the directory (/) FormPath = Upload. Form ("UlsaveFilePath") if right (FormPath, 1) <> "/" THEN FORMPATH = FormPath & "End if if file.filesize <100 THEN DOUPLOADFILE = 1 'file size too small exit function end if fix. FileSize> MaxUPloadsize the dolploadFile = 2 'file size exceeds limit function end if fileext = lcase (Right (file.filename, 4)) UPLOADSUC = false if not (fileext = ".gif" OR feed = ".jpg") The douploadfile = 3 'file format is incorrect EXIT FUNCTION End if Random Ize Rannum = int (90000 * RND) 10000 'File Name FileName = FormPath & Year (now) & Month (NOW) & HOUR (NOW) & Minute (NOW) & Second (Now) & Rannum & Rannum & 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%>