Upload. asp
<Form action = http: // <% = Request. ServerVariables (SERVER_NAME)>/wdread. asp method = post>
<P> topic: <input type = text name = subject> <br>
Author: <input name = author type = text> <br>
Release date: <input name = date1 type = text> <br>
Upload file: <input type = file name = filename>
Sent to URL: <input type = hidden name = TargetURL value = http: // <% = Request. serverVariables (SERVER_NAME) %>/users/<% = Request. serverVariables (LOGON_USER) %> size = 20> <br>
<Input type = submit value = OK> </p>
</Form>
Wdread. asp
<Form enctype = multipart/form-data action = http: // <% = Request. ServerVariables (SERVER_NAME) %>/scripts/cpshost. dll? PUBLISH? Wdwriter. asp method = post name = form1>
Upload file: <input type = file name = filename value = <% = session (filename) %>
<Input type = hidden name = TargetURL value = http: // <% = Request. ServerVariables (SERVER_NAME) %>/users/wdls>
<Input type = button name = upload value = OK>
</Form>
<Scripts language = VBScript>
'During the upload, the filename value of the form field and upload should be taken. asp program to compare the domain values, because in upload. the file name entered in asp is preset to the form field filename in this program. Once the client re-enters the new file name and submits the confirmation, the program wdwriter. the file name written to the database in asp is different from the actual uploaded file name, leading to a webpage connection error. if the two are the same, upload them immediately. Otherwise, cancel the operation.
<! --
Sub upload_nclick ()
Set myformdomainmetadata Doc ument. form1
Tmp = myform. filename. value
If strcomp (tmp, <% = session
(Filename) %>) = 0 then
Form1.submit
Else
Msgbox Oh, the file name you entered is incorrect. Please try again!
End if
End sub
-->
</Scripts>
Wdwriter. asp
<%
Set mydata = Server. CreateObject (ADODB. Connection) mydata. Open DSN = xczh; UID = sa; PWD =;
'Open the database.
Date1 = session (date1)
'Get the value of each form field. Take the time.
Subject = session (subject)
'Get the file topic.
Author = session (subject)
'Get author.
Filename = session (filename)
'Get the file name.
TargetURL = session (TargetURL)
'Obtain the physical address of the file stored on the server.
Sqlstr = insert into wdlsb values (& sn &, & subject & ', & date1 &', & filename & ', & TargetURL &', & author &')
'Write the database and save it.
Mydata. Execute (sqlstr)
%>
[1]