Implement synchronous Upload of images and text using pure asp code

Source: Internet
Author: User
Tags access database
I saw an article on the Internet, modified it and combined it with xml to achieve synchronous Upload of image text!
3 files in total: upload.htm, uploadtext. asp, uploadimg. asp
Create an access database named text. mdb and a table named imgtable
The fields include text1 and img, and an incremental id field.
The code is as follows:
<Title> synchronous Upload of image text </title>
<Meta name = "dongbao" content = "text/html; charset = gb2312" http-e
Quiv = "Content-Type">
<Script language = "javascript">
<! -- Hide me
Function upload ()
Var xmlhttp = new ActiveXObject ("Microsoft. XmlHttp ");
Var textcontent = "<textcontent> <name>" + document. formtext. name. va
Lue + "</name> </textcontent> ";
Xmlhttp. Open ("POST", "uploadtext. asp", false );
Xmlhttp. Send (textcontent );
Return true;
// Show me -->
<Form action = "uploadimg. asp" enctype = "multipart/form-data" method
= "Post" onsubmit = "return upload ();">
<Input name = "picture" type = "file"/>
<Input type = "submit"/>
<Form name = "formtext">
<Input name = "name"/>
Showpicture. asp:
<% @ Language = VBScript %>
Set conn = server. CreateObject ("adodb. connection ")
Dbpath = server. MapPath ("test. mdb ")
Conn. Open "driver = {Microsoft Access Driver (*. mdb)}; dbq =" & dbpath
Set xmldom = server. CreateObject ("Microsoft. XmlDom ")
Xmldom. load (request)
Name = xmldom. selectsinglenode ("// name"). text
SQL = "insert into imgtable (text1) values ('" & name &"')"
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.