Upload | no component ' #####################################################################
' Remark: I did not verify, provided to you a reference! Please verify by yourselves
' Welcome to the wonderful program code you think is good
' Gale (Xuankong) 2000. 12. 8
'#####################################################################
Title: or upload it with my component-free file, as with the ASPCN component, here is a routine:
Author: Dudu (DUSJ)
Time: 2000-12-7 09:48:00
Number of reads: 8
Detailed information:
-----------------------------
The contents of the Form Fill page:
-----------------------------
<meta name= "Author" content= "Sander Duivestein" >
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "generator" content= "Microsoft FrontPage 4.0" >
<meta name= "ProgId" content= "FrontPage.Editor.Document" >
<title> upload a local file to the database </title>
<body>
<font size= "2" size= "2" ><br>
</font>
<form name= "Frmupload" method= "post" enctype= "Multipart/form-data" action= "upload.asp" >
<table cellspacing= "0" cellpadding= "0" width= "490" >
<tr>
<TD width= "167" >
<p align= "right" ><font size= "2" size= "2" > Please select File:</font></p>
</td>
<TD width= "319" ><font size= "2" size= "2" ><input type= "file" Name= "Vfilename" ></font></td >
</tr>
<tr>
<TD align= "Right" width= "167" ><font size= "2" size= "2" > Document description 1:</font></td>
<TD width= "319" ><input name= "shuoming" size= "></font></td>"
</tr>
<tr>
<TD align= "Right" width= "167" ><font size= "2" size= "2" > Document description 2:</font></td>
<TD width= "319" ><input name= "shuoming_2" "size=" onchange= "Isdate1" (Document.frmUpload.dengji) "</TD" >
</tr>
<TD width= "167" ></td>
<TD width= "319" >
<p align= "left" ><font size= "2" size= "1" ><input type= "Submit" style= "Background-image:url (' images/ Back.jpg '); Cursor:hand; Font-sizd:smaller; left:0px; width:94; top:5px; Height:25 "value=" Upload "style=" background-image:url (' images/back.jpg '); Cursor:hand; Font-sizd:smaller; left:0px; width:94; top:5px; Height:25 "Size=" ></font></p>
</td>
<tr>
<TD colspan= "2" align= "right" width= "487" ></td>
</tr>
</table>
</form>
</body>
----------------------------------
Content of Upload.asp:
----------------------------------
<%
Response.Buffer = TRUE
Response.Clear
ByteCount = Request.TotalBytes
Requestbin = Request.BinaryRead (ByteCount)
' Response.BinaryWrite Requestbin
' Get all the contents of the form
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim Uploadrequest
Set uploadrequest = CreateObject ("Scripting.Dictionary")
' Uploadrequest structure will be used to store forms
Posbeg = 1
Posend = InstrB (Posbeg,requestbin,stob (Chr (13)))
Boundary = MidB (Requestbin,posbeg,posend-posbeg)
' Ask for a separate string between fields (that is,-----------------------------7d029e347d8)
Boundarypos = InstrB (1,requestbin,boundary)
Do Until (BOUNDARYPOS=INSTRB (Requestbin,boundary & Stob ("--)")
' members variable of the objects are put in a Dictionary object
Dim Uploadcontrol
Set Uploadcontrol = CreateObject ("Scripting.Dictionary")
' Get ' object name
Pos = InstrB (Boundarypos,requestbin,stob ("Content-disposition"))
Pos = InstrB (Pos,requestbin,stob ("Name="))
Posbeg = pos+6
Posend = InstrB (Posbeg,requestbin,stob (Chr (34)))
Name = Btos (MidB (Requestbin,posbeg,posend-posbeg))
Posfile = InstrB (Boundarypos,requestbin,stob ("Filename="))
Posbound = InstrB (posend,requestbin,boundary)
' Response.Write ' ' Response.Write ' name= ' &name& ' <BR> '
' Name is the name of the table item
' Test if object is of file type
If posfile<>0 and (Posfile<posbound) Then
Posbeg = Posfile + 10
Posend = InstrB (Posbeg,