This problem I have just two days ago, hehe (will not join the elite area)

Source: Internet
Author: User
Tags include join
Essence | Problem Case table Test
ID int IDENTITY (1, 1) not NULL;
Testtext ntext;
Images image;

The forms in the submission file are set as follows:
<form method= "POST" action= "upload.asp" Name= "Form1" enctype= "Multipart/form-data" target= "_blank" >
Figure: <input type= "file" Name= "File1" ></form>
<form method= "POST" action= "textprocess.asp" onsubmit= "return Validate (this);" Name= "Form2" >
<input type= "text" name= "Testtext" >
</form>

Also add the following code to the head of the file that submits the form:
<script language= "JavaScript" >
function Validate (Form2)
{
Form1.submit ();
}
</script>

The main code in upload.asp:
<!--#include file= "connectdb.asp"--><%
Formsize = Request.TotalBytes ' Get data
FormData = Request.BinaryRead (formsize)

function Imageup (formsize,formdata) ' functions are to intercept the part of the image.
BNCRLF=CHRB & ChrB (10) ' After the function is made. You can use it at your own discretion later.
Divider=leftb (FORMDATA,INSTRB (FORMDATA,BNCRLF)-1)
DATASTART=INSTRB (FORMDATA,BNCRLF&AMP;BNCRLF) +4
DATAEND=INSTRB (Datastart+1,formdata,divider)-datastart
IMAGEUP=MIDB (Formdata,datastart,dataend)
End Function

Image=imageup (Formsize,formdata) ' This is the image part.

If formsize<> "" Then
Response.Write "Uploading Your signature picture ....<br>"
Set Rs=server. CreateObject ("Adodb.recordset")
Sql= "SELECT * from test where ID is null"
Rs. Open sql,conn,1,3
Rs. AddNew ' because form two was submitted in the process of single submission of the form.
RS ("Images"). AppendChunk Image ' So here is added.
Rs. Update
Rs. Close
Set rs=nothing
Conn.close
Set conn=nothing
Response.Write "Signature picture upload end!<br>"
End If%>

Textprocess.asp Main code:
<!--#include file= "connectdb.asp"-->
<%
Set Rs2=server. CreateObject ("Adodb.recordset")
Rs2.open "SELECT top 1 * FROM Test ORDER BY id DESC", conn,1,3
RS2 ("Testtext") =request ("Testtext")
Rs2.update
Rs2.close
Set rs2=nothing%>

Here is the code to display the picture showimg.asp
<!--#include file= "connectdb.asp"-->
<%
Response.expires=0
Response.buffer=true
Response.Clear
Response.ContentType = "image/*"


Set Rs=createobject ("Adodb.recordset")
Sql= "SELECT * from Test where id=" & Request.QueryString ("id")
Rs.Open sql,conn,1,1

Response.BinaryWrite rs ("signature")

Rs.close
Set rs=nothing
Conn.close
Set conn=nothing%>

OK, the place to show the picture as long as write on it, this I tested under WIN2K,SQL2K, no problem



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.