Image uploaded ASP code

zhaozj2021-02-16  60

Folder Name: Upload: [UPLOAD0.ASP, UPP.ASP, UPLOADX.ASP, IMAG: Store the uploaded picture / file folder]

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@ upload0.asp

Photo: multiple times Oh -> <% = request (" file ")%> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ upp.asp <% @ Language = vbscript%> <% server.scripttimeout = 100000%> // Set the maximum running time of the upload file <% DIM filenamepath = server.mappath ("./Imag/")filename = Savefile (" Fruit ", PATH, 6000, 0) // Set the maximum upper limit of the upload file IF filename <>" "THEN FileName <> * TOOBIG *" THEN Response.Redirect "UPLOAD0.ASP? Message =" & filename & "" elseresponse.redirect "UPLOAD0.ASP? Message = file beyond the limit is too large (<= 6000K)" End IFEND IF%>

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ uploadx.asp

<% Dim FormData, FormSize, Divider, bCrLfFormSize = Request.TotalBytesFormData = Request.BinaryRead (FormSize) bCrLf = ChrB (13) & ChrB (10) Divider = LeftB (FormData, InStrB (FormData, bCrLf) - 1) Function SaveFile ( FormFileField, Path, MaxSize, SavType) Dim StreamObj, StreamObj1 Set StreamObj = Server.CreateObject ( "ADODB.Stream") Set StreamObj1 = Server.CreateObject ( "ADODB.Stream") StreamObj.Mode = 3 StreamObj1.Mode = 3 StreamObj. TYPE = 1 streamobj1.type = 1 Savefile = "" StartPos = lenb (divider) 2 Formfilefield = CHR (34) & flmfilefield & chr (34) IF Right (Path, 1) <> "/" THEN PATH = PATH & "/" End If Do While StartPos> 0 strlen = InStrB (StartPos, FormData, bCrLf) - StartPos searchStr = MidB (FormData, StartPos, strlen) If InStr (bin2str (searchStr), FormFileField)> 0 Then FileName = bin2str (GetFileName (SearchStr, Path, SavType))) ifeName <> "" THEN FileStart = INSTRB (StartPos, Formdata, BCR Lf & bCrLf) 4 FileLen = InStrB (StartPos, FormData, Divider) - 2 - FileStart If FileLen <= MaxSize * 1024 Then FileContent = MidB (FormData, FileStart, FileLen) StreamObj.Open StreamObj1.Open StreamObj.Write FormData StreamObj. Position = filestart-1 streamobj.copyto streamobj1, filelen if savtype = 0 Then SavType =

1 End If StreamObj1.SaveToFile Path & FileName, SavType StreamObj.Close StreamObj1.Close If SaveFile <> "" Then SaveFile = SaveFile & "," & FileName Else SaveFile = FileName End If Else If SaveFile <> "" Then SaveFile = SaveFile & ", * Toobig *" Else Savefile = "* TOOBIG *" END IF END IF END IF END IF IF INSTRB (STARTPOS, FORMDATA, DIVIDER <1 THEN EXIT DO END IF StartPos = INSTRB (StartPos, FormData, Divider) LeNB (Divider) 2 Loopend Function

Function GetFormVal (FormName) GetFormVal = "" StartPos = LenB (Divider) 2 FormName = Chr (34) & FormName & Chr (34) Do While StartPos> 0 strlen = InStrB (StartPos, FormData, bCrLf) - StartPos SearchStr = MidB (FormData, StartPos, strlen) If InStr (bin2str (searchStr), FormName)> 0 Then ValStart = InStrB (StartPos, FormData, bCrLf & bCrLf) 4 ValLen = InStrB (StartPos, FormData, Divider) - 2 - ValStart ValContent = MidB (FormData, ValStart, ValLen) If GetFormVal <> "" Then GetFormVal = GetFormVal & "," & bin2str (ValContent) Else GetFormVal = bin2str (ValContent) End If End If If InStrB (StartPos, FormData, Divider) <1 Then EXIT DO End if StartPos = INSTRB (StartPos, Formdata, Divider) LENB (Divider) 2 Loopend FunctionFunction Bin2Str (Binstr) Dim Varlen, Clow, CCC, Skipflag Skipflag = 0 CCC = "" Varle n = lenb (binstr) for i = 1 to varlen if Skipflag = 0 THEN CLOW = MIDB (Binstr, I, 1) IF ASCB (CLOW)> 127 TEN CCC = CCC & Chr (ASCW (MIDB (Binstr, i 1 , 1) & liquid = 1 else ccc = ccc & chr (ASCB (CLOW) end if else skipflag = 0 end if next bin2str = cccend function

Function str2bin (str) for i = 1 to Len (str) str2bin = str2bin & chrb (ASC (MID (STR (STR (STR, I, 1))) NEXTEND FUNCTION

转载请注明原文地址:https://www.9cbs.com/read-24081.html

New Post(0)