How does one enable file upload and automatic categorization?

Source: Internet
Author: User
Tags date1 servervariables

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]

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.