Upload | upload pictures | No components First, the picture can find the selection in the page. Design form page index.asp and upload Selection page upload.asp,upload.asp included in index.asp with IFRAME.
Second, the selected picture should be able to upload to a folder. Create a folder uploadimg
Finally, how do you refer to the image you are transmitting? Obviously, the UBB is displayed immediately. The Upload.asp object upfile.asp has the ability to write to the UBB tag.
Pictures uploaded using the old farmer's no component upload. So upload.inc files are essential.
1,upload.inc (copy all code for the following text box)
<script Runat=server language=vbscript>
Dim Upfile_5xsoft_stream
Class Upload_5xsoft
Dim form,file,version
Private Sub Class_Initialize
Dim istart,ifilenamestart,ifilenameend,iend,vbenter,iformstart,iformend,thefile
Dim strdiv,mformname,mformvalue,mfilename,mfilesize,mfilepath,idivlen,mstr
Version= ""
If Request.totalbytes<1 then Exit Sub
Set Form=createobject ("Scripting.Dictionary")
Set File=createobject ("Scripting.Dictionary")
Set Upfile_5xsoft_stream=createobject ("ADODB.stream")
Upfile_5xsoft_stream.mode=3
Upfile_5xsoft_stream.type=1
Upfile_5xsoft_stream.open
Upfile_5xsoft_stream.write Request.BinaryRead (request.totalbytes)
VBENTER=CHR (&CHR) (10)
Idivlen=instring (1,vbenter) +1
Strdiv=substring (1,idivlen)
Iformstart=idivlen
Iformend=instring (Iformstart,strdiv)-1
While Iformstart < Iformend
Istart=instring (Iformstart, "name=" "")
Iend=instring (Istart+6, "" "")
Mformname=substring (istart+6,iend-istart-6)
Ifilenamestart=instring (iend+1, "filename=" "")
If Ifilenamestart>0 and Ifilenamestart<iformend then
Ifilenameend=instring (ifilenamestart+10, "" "")
Mfilename=substring (IFILENAMESTART+10,IFILENAMEEND-IFILENAMESTART-10)
Istart=instring (Ifilenameend+1,vbenter&vbenter)
Iend=instring (Istart+4,vbenter&strdiv)
If Iend>istart Then
Mfilesize=iend-istart-4
Else
Mfilesize=0
End If
Set Thefile=new FileInfo
Thefile.filename=getfilename (Mfilename)
Thefile.filepath=getfilepath (Mfilename)
Thefile.filesize=mfilesize
Thefile.filestart=istart+4
Thefile.formname=formname
File.add Mformname,thefile
Else
Istart=instring (Iend+1,vbenter&vbenter)
Iend=instring (Istart+4,vbenter&strdiv)
If Iend>istart Then
Mformvalue=substring (istart+4,iend-istart-4)
Else
Mformvalue= ""
End If
Form. ADD Mformname,mformvalue
End If
Iformstart=iformend+idivlen
Iformend=instring (Iformstart,strdiv)-1
Wend
End Sub
Private Function subString (Thestart,thelen)
Dim i,c,stemp
Upfile_5xsoft_stream.position=thestart-1
Stemp= ""
For I=1 to TheLen
If Upfile_5xsoft_stream.eos then Exit for
C=ASCB (Upfile_5xsoft_stream.read (1))
If C > 127 Then
If Upfile_5xsoft_stream.eos then Exit for
STEMP=STEMP&CHR (AscW (ChrB (AscB (Upfile_5xsoft_stream.read (1)) &CHRB (c)))
I=i+1
Else
STEMP=STEMP&CHR (c)
End If
Next
Substring=stemp
End Function
Private Function instring (THESTART,VARSTR)
Dim i,j,bt,thelen,str
Instring=0
Str=tobyte (VARSTR)
Thelen=lenb (STR)
For I=thestart to Upfile_5xsoft_stream.size-thelen
If I>upfile_5xsoft_stream.size then Exit Function
Upfile_5xsoft_stream.position=i-1
If AscB (Upfile_5xsoft_stream.read (1)) =ASCB (MidB (str,1)) Then
Instring=i
For j=2 to TheLen
If Upfile_5xsoft_stream.eos Then
Instring=0
Exit for
End If
If AscB (Upfile_5xsoft_stream.read (1)) <>ASCB (MidB (str,j,1)) Then
Instring=0
Exit for
End If
Next
If Instring<>0 then Exit Function
End If
Next
End Function
Private Sub Class_Terminate
Form. RemoveAll
File. RemoveAll
Set form=nothing
Set file=nothing
Upfile_5xsoft_stream.close
Set upfile_5xsoft_stream=nothing
End Sub
Private function GetFile