This problem I have just two days ago, hehe (will not join the elite area)
Source: Internet
Author: User
Example 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&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.
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.