No component upload images to the database, the most complete solution

zhaozj2021-02-16  60

':::::::::::::::::::::::::::::::

':::::: in SQL2000, 2000S pass :::::::::

'::::::: Contact me: QQ: 21112856, email: yangzinet@hotmail.com :::::::::

'::::::: http://www.tingfo.net ::::::

Up.htm

<% = webname%> < / title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312"> <link rel = "stylesheet" href = "main.css" type = "text / css"> <style TYPE = "text / css"> <! -. TX1 {height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: Black Black</p> <p># 000000; Color: # 0000FF} -> </ stop></p> <p><script language = "javascript"> <! - var BGC_ON = New Array ("# ​​74d738", "# ff9c17", "# 3278ab", "# 486177", "# 078c00", "# 007eca") VAR BGC_OFF = New Array ("# ​​4CAD12", "FFB859", "5FD0", "577590", "08A700", "009FFF")</p> <p>Function Turnon (Obj1.Style.Background = BGC_ON [ID];} Function Turnoff (Obj1, ID) {Obj1.Style.Background = BGC_OFF [ID];</p> <p>// -> </ script> <script language = javascript> Function check_input () {if (frm.pic.value == ") {alert (" Please select the picture you want to upload "); return false;} (Frm.type.value == "" ") {Alert (" Please select Picture Type ");} f (frm.thett.value ==") {Alert ("Please enter photo description"); Return False;}}} </ script> </ head></p> <p><body bgcolor = "# 55555" Text = "# 000000" Leftmargin = "0" TopMargin = "0"> <table width = 755 cellpadding = 0 cellspacing = 0 border = 0 bgcolor = # ffffff align = "center"> < Tr> <TD Height = 100> <img src = "img / Top.gif" align = "top"> </ table> <! - # include file = "inc / mulu.asp" -></p> <p><table width = 755 cellpadding = 0 cellspacing = 0 border = 0 bgcolor = # fff align = "center" bordercolor = # 000000> <tr> <td height = 400 width = 180 bgcolor = # d19d5 style = "Border-Right: 1px # 0e801e solid "> <table width = 100% height = 100% cellpadding = 0 cellspacing = 0 border = 0 align =" center "bordercolor = # 000000> <tr> <td height = 30 align =" center "class = L15> <font color = # e96d08> Welcome: <% = username%> management center </ font> <tr> <td height = 23 align = "center" class = l15 bgcolor = # 4cad12 style = "Border-TOP : 0px # 0e801e solid; border-bottom: 1px # 0e801e solid; "> <font color = # c2f009 class = yinying> management center </ font> <tr> <td height = 20 class = l13> <! - # Include file = "inc / centermulu.asp" -> <tr> <td height = 5> <tr> <td> </ table> <td> <% set = server.createObject ("adoDb.recordset") SQL = "Select * from photo where author = '" & username "" ropen sql, conn, 1, 1%> <table cellpadding = 0 cellspacing = 0 border = 0 width = 100% height = 100%> <TR > <TD Height = 3> <TD Height = 3 BGColor = # ffffffFFFFFFFFFFFFFFFFFFFFFF> <tr> <TD height = 20 valign = "bottom" bgcolor = # eeeeee> Current location: 98243 - tube Center - Add News <TR> <TD Height = 3 BGColor = # eeeeee style = "border-bottom: 1px #cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc Solid"> <p style = "font-size: 1pt"> <tr> <td height = 20 Valign = "bottom"> <font color = Green> <</p> <p>% = Username%>: You uploaded <font color = red> <% = rs.recordcount%> </ font> photo </ font> <a href="adminphoto.asp"> <font color = red> <u> Previous Uploaded Photo </ u> <TD BGColor = # ffffff Valign = TOP> <Table Cellpadding = 0 Cellspacing = 0 border = 0 width = 95% Height = 100% align = "center"> <form action = addphoto.asp method = post name = fm onSubmit = "Return Check_input ()" ENCTYPE = "Multipart / Form-Data"> <TR> <TD Height = 20 COLSPAN = 2 > <tr> <td height = 25 width = 15% align = "right" class = L13> Select photo: <TD> <input name = "type =" cass = "tx1" style = "width: 300> <font color = red> Reject porn, photo map, etc. </ font> <tr> <td height = 25 width = 20% align = "right" class = L13> Photo category: <TD> <select name = "Type"> <option selected value = ""> Select type </ option> <option value = "class photo"> class photo </ option> <option value = "Personal Photos"> Personal Photo </ option> <Option Value = "照片 photos"> 师 photo </ option> <option value = "Valentine photos"> Valentine photos </ option> <option value = "Friends photos"> Friends photos </ option> <option value = "Other photos "> Other photos </ option> </ select></p> <p><Tr> <TD Height = 25 Width = 20% Align = "Right" Class = L13> Photo Description: <TD> <textarea name = "THETEXT" cols = "46" rows = "7" style = "border: 1px Double RGB (88, 88, 88); font: 9pt "> </ textarea> <font color = red> Up to 20 characters </ font> <tr> <td height = 5 colspan = 2> <Tr> <TD Height = 25 colspan = 2 align = "center"> <input type = "submit" name = "Submit" value = "submit" style = "border: 1px double RGB (88, 88, 88); font: 9pt"> <input type = "value =" reset "value =" rewrites "style =" border: 1px double RGB (88, 88, 88); font: 9pt "> <TR> <TD colSpan = 2> </ Tr> </ form> </ table> </ table> </ table> <! - # include file = "inc / footer.asp" -> </ body> </ html></p> <p>Fupload.inc</p> <p><Script runat = server language = vbscript> limit Upload Image Size DIM UPLOADSIZELIMIT</p> <p>'*************************************************************************************** ********************** FUNCTION GETUPLOAD () Dim ResultSet Result = Nothingif Request.ServerVariables ("Request_Method") = "Post" Ten 'Request Method Must Be " POST "Dim CT, PosB, Boundary, Length, PosECT = Request.ServerVariables (" HTTP_Content_Type ") 'reads Content-Type headerIf LCase (Left (CT, 19)) =" multipart / form-data "Then' Content-Type header Must Be "Multipart / Form-Data" 'this is upload request.'get the boundary and length from content-type headerposb = instr (lcase (ct), "boundary =")' Finds Boundaryif POSB> 0 THEN Boundary = MID ( CT, PosB 9) 'Separetes boundaryLength = CLng (Request.ServerVariables ( "HTTP_Content_Length"))' Get Content-Length headerif "" & UploadSizeLimit <> "" thenUploadSizeLimit = clng (UploadSizeLimit) if Length> UploadSizeLimit then 'on error resume Next 'Clears The Input Buffer' Response.addheader "Connection", "Close" 'On Error Goto 0Request.binaryRead (Length) Err.raise 2, "Getupload", "Upload Size" & FormatNum ber (Length, 0) & "B exceeds limit of" & FormatNumber (UploadSizeLimit, 0) & "B" exit functionend ifend ifIf Length> 0 And Boundary <> "" Then 'Are there required informations about upload Boundary =? "- - "& boundarydim head, binarybinary = request.binaryread (length) 'Reads binary data from client'Rtrieves the Upload Fields from binary DataSet Result = SeparateFields (binary, boundary) binary = empty'</p> <p>Clear VariableSelseerr.raise 10, "Getupload", "Zero Length Request." End ifelseerr.raise 11, "Getupload", "NO File Sent." End Ifelseerr.raise 1, "Getupload", "Bad Request Method." End ifset. " Getupload = Resultens FunctionFunction Separatefields (Binary, Boundary) Dim Posopenboundary, Poscloseboundary, Posndofheader, IslastBoundaryDim FieldsBoundary = StringTobinary (Boundary)</p> <p>Posopenboundary = INSTRB (Binary, Boundary) PoscloseBoundary = INSTRB (Posopenboundary lenb (boundary), binary, boundary, 0)</p> <p>Set Fields = CreateObject ("scripting.dictionary")</p> <p>Do While (PosOpenBoundary> 0 And PosCloseBoundary> 0 And Not isLastBoundary) 'Header and file / source field dataDim HeaderContent, FieldContent'Header fieldsDim Content_Disposition, FormFieldName, SourceFileName, Content_Type'Helping variablesDim Field, TwoCharsAfterEndBoundary'Get end of headerPosEndOfHeader = InstrB (PosOpenBoundary Len (Boundary), Binary, StringTobinary (VBCRLF VBCRLF))</p> <p>'Separates field headerHeaderContent = MidB (Binary, PosOpenBoundary LenB (Boundary) 2, PosEndOfHeader - PosOpenBoundary - LenB (Boundary) - 2)' Separates field contentFieldContent = MidB (Binary, (PosEndOfHeader 4), PosCloseBoundary - (PosEndOfHeader 4 ) - 2)</p> <p>'Separates Header Fields from Headergetheadfield, Content_Disposition, FormfieldName, SourceFileName, Content_Type</p> <p>'Create one field and assign parametersSet Field = CreateUploadField () Field.Name = FormFieldNameField.ContentDisposition = Content_DispositionField.FilePath = SourceFileNameField.FileName = GetFileName (SourceFileName) Field.ContentType = Content_TypeField.Value = FieldContentField.Length = LenB (FieldContent) Fields. Add FormfieldName, Field</p> <p>'Is this ending boundary TwoCharsAfterEndBoundary = BinaryToString (MidB (Binary, PosCloseBoundary LenB (Boundary), 2))?' Binary.Mid (PosCloseBoundary Len (Boundary), 2) .StringisLastBoundary = TwoCharsAfterEndBoundary = "-" If Not isLastBoundary Then 'This is not ending boundary - go to next form field.PosOpenBoundary = PosCloseBoundaryPosCloseBoundary = InStrB (PosOpenBoundary LenB (boundary), Binary, boundary) End IfLoopSet SeparateFields = FieldsEnd Function</p> <p>'******************************** UTILITIES ************** ******************** FUNCTION BINARYTOSTRING (STR) STRTO = "" For i = 1 to lenb (str) IF ASCB (MIDB (STR, I, 1)) > 127 THENSTRTO = STRTO & CHR (ASCB (MIDB (STR, I, 1)) * 256 ASCB (MIDB (STR, I 1, 1))) i = i 1ELSESTRTO = STRTO & CHR (ASCB (MIDB STR, I, 1))) End ifnextbinaryTostring = STRTOEND FUNCTION</p> <p>Function StringTobinary (String) DIM I, BFOR I = 1 to Len (String) B = B & ChRB (ASC (MID (String, I, 1))) Next StringTobinary = Bend Function</p> <p>'Separates header fields from upload headerFunction GetHeadFields (ByVal Head, Content_Disposition, Name, FileName, Content_Type) Content_Disposition = LTrim (SeparateField (Head, "content-disposition:", ";")) Name = (SeparateField (Head, "name = ","; ")) 'LTRIMIMIF LEFT (Name, 1) =" "" "" "" "", 2, len (name) - 2) filename = (SeparateField (Head, "FileName =", ")) 'LTRIMIF LEFT (FILENAME, 1) =" "" "" "" ", 2, len (filename) - 2) Content_type = LTRIM (SeparateField (Head," Content-Type: ","; " )) End Function'Separets one filed between sStart and sEndFunction SeparateField (From, ByVal sStart, ByVal sEnd) Dim PosB, PosE, sFromsFrom = LCase (From) PosB = InStr (sFrom, sStart) If PosB> 0 ThenPosB = PosB Len (SSTART) POSE = INSTR (POSB, SFROM, Send) if Pose = 0 Then Pose = IF POSE = 0 Then Pose = LEN (SFROM) 1seParateField = MID (from, POSB, POSE - POSB) elseseparatefield = EMPTYEND IFEND FUNCTION</p> <p>'Separetes File Name from the Full Path of Filefunction GetFileName (Fullpath) DIM POS, POSFPOSF = 0for Pos = LEN (FULLPATH) TO 1 Step -1Select Case Mid (Fullpath, POS, 1) Case "/", "/": POSF = Pos 1: Pos = 0End SelectNextIf PosF = 0 Then PosF = 1GetFileName = Mid (FullPath, PosF) End function </ SCRIPT> <SCRIPT RUNAT = SERVER LANGUAGE = JSCRIPT> // The function creates Field object.function CreateUploadField () {return new uf_Init ()} function uf_Init () {this.Name = nullthis.ContentDisposition = nullthis.FileName = nullthis.FilePath = nullthis.ContentType = nullthis.Value = nullthis.Length = null} </ SCRIPT> addphoto.asp < ! - # include file = "conn.asp" -> <! - # include file = "inc / domin.asp" -> <! - # include file = "fupload.inc" -> < % if Request.ServerVariables ( "REQUEST_METHOD") = "POST" ThenDim FieldsUploadSizeLimit = 100000Set Fields = GetUpload () dim FieldFor Each Field In Fields.Itemsselect case Field.namecase "thetext" sss = BinaryToString (field.value) case "type" FFF = binarytostring (field.value) case "submit" Submit = Bin aryToString (Field.value) case "pic" filename = field.FileNamefileContentType = field.ContentTypefilevalue = field.valueend selectnext '--------------- if filename <> "" and fileContentType <> "image / gif" and</p> <p>fileContentType <> "image / pjpeg" then%> <center> <br> <br> <font color = red size = 3> uploading photos should be JPG or GIF files! </ Font> <br> <br> <input type = "button" value = "refill" οnclick = "history.go (-1); returntrue;"> </ center> <% else '---- -------- 'Start enter' ----------- response.write sssresponse.write "<br>" response.write fffset = server.createObject ("adoDb.recordset") SQL = "Select * from Tb Where Theid is Null" RS.Open SQL, CONN, 3, 3RS.AddNewRS ("Author") = SSSRS ("Types") = fffrs ("hits") = fffrs ("HITS") = 1RS ("posttime") = now () RS ("photo"). Appendchunk FileValue</p> <p>rs.close%> rs.update <br> <br> <center> <font color = red</p> <p>Size = 3> Enter personal basic files successfully! </ Font> <br> <br> <form method = "post"</p> <p>Action = "personinf.asp"> <input type = "submit" value = "Back"> </ form> </ center> <% end ifnd IF%></p> <p>Showpic.asp <! - # clude file = "conn.asp" -> <% id = request ("id") set = server.createObject ("adoDb.recordset") SQL = "SELECT * from TB Where THEID = "& idrs.open SQL, CONN, 1, 3RESPONSE.CONTENTTYPE =" image / gif "response.binaryWrite RS (" photo ")%></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-23955.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="23955" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.055</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '6iXCtJxTf2mBj10wbMXBJHwTE4cL8rWFuIbw9225bCtNdLIX5sR_2ByZmuYrqmrcWRwlNKLCuGOmBbiW6U8dBQTA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>