This article is provided by topic.alibabacloud.com, which describes how to use ASP to upload binary images and save them to an Access database.
The specific implementation code is as follows:
Save Picture User upload page (3.asp):
Save Picture Page (2.asp):
<%response.buffer=trueformsize=request.totalbytesformdata=request.binaryread (formsize) Bncrlf=chrB () & ChrB (PIDER=LEFTB) (FORMDATA,CLNG (INSTRB (FORMDATA,BNCRLF))-1) datastart=instrb (Formdata,bncrlf & Bncrlf) + 4DATAEND=INSTRB (Datastart+1,formdata,pider)-datastartmydata=midb (formdata,datastart,dataend) Set connGraph= Server. CreateObject ("Adodb.connection") Conngraph.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\PHP\valve.mdb;" Set Rec=server.createobject ("Adodb.recordset") rec. Open "SELECT * from [user]", Conngraph,1,3rec.addnewrec ("img"). AppendChunk Mydatarec.updaterec.closeset rec= NothingSet conngraph=nothing%>
Picture Reading page (1.asp): This page does not allow HTML code, otherwise it will appear garbled!
<%set rs=server.createobject ("Adodb.recordset") sql= "" Rs.Open strsql,conngraph,1,1response.contenttype = "image/ * "Response.BinaryWrite RS (" "). GetChunk (8000000)%>
The number in GetChunk () must be greater than or equal to the number of picture bytes to display, otherwise the picture is not completely displayed!
Picture Display page (4.asp):
Article Address: http://www.php.cn/csharp-article-377483.html
Learn programming to topic.alibabacloud.com www.php.cn
~~~~