CopyCode The Code is as follows: <%
'-- Loader. asp --
'-- Version 1.5.2
'-- Last updated 12/5/2002
'
'Faisal Khan
'Faisal@stardeveloper.com
'Www.starting.com
'Class for handling binary uploads
Class Loader
Private dict
Private sub class_initialize
Set dict = server. Createobject ("scripting. Dictionary ")
End sub
Private sub class_terminate
If isobject (intdict) then
Intdict. removeall
Set intdict = nothing
End if
If isobject (dict) then
Dict. removeall
Set dict = nothing
End if
End sub
Public property get count
Count = dict. Count
End Property
Public sub initialize
If request. totalbytes> 0 then
Dim bindata
Bindata = request. binaryread (request. totalbytes)
Getdata bindata
End if
End sub
Public Function getfiledata (name)
If dict. exists (name) then
Getfiledata = dict (name). Item ("value ")
Else
Getfiledata = ""
End if
End Function
Public Function getvalue (name)
Dim gv
If dict. exists (name) then
GV = CSTR (dict (name). Item ("value "))
GV = left (GV, Len (GV)-2)
Getvalue = gv
Else
Getvalue = ""
End if
End Function
Public Function savetofile (name, PATH)
If dict. exists (name) then
Dim temp
Temp = dict (name). Item ("value ")
Dim FSO
Set FSO = server. Createobject ("scripting. FileSystemObject ")
Dim File
Set file = FSO. createtextfile (PATH)
For tpoint = 1 to lenb (temp)
File. Write CHR (ASCB (midb (temp, tpoint, 1 )))
Next
File. Close
Savetofile = true
Else
Savetofile = false
End if
End Function
Public Function getfilename (name)
If dict. exists (name) then
Dim temp, temppos
Temp = dict (name). Item ("FILENAME ")
Temppos = 1 + Rev (temp ,"\")
Getfilename = mid (temp, temppos)
Else
Getfilename = ""
End if
End Function
Public Function getfilepath (name)
If dict. exists (name) then
Dim temp, temppos
Temp = dict (name). Item ("FILENAME ")
Temppos = rev (temp ,"\")
Getfilepath = mid (temp, 1, temppos)
Else
Getfilepath = ""
End if
End Function
Public Function getfilepathcomplete (name)
If dict. exists (name) then
Getfilepathcomplete = dict (name). Item ("FILENAME ")
Else
Getfilepathcomplete = ""
End if
End Function
Public Function getfilesize (name)
If dict. exists (name) then
Getfilesize = lenb (dict (name). Item ("value "))
Else
Getfilesize = 0
End if
End Function
Public Function getfilesizetranslated (name)
If dict. exists (name) then
Temp = lenb (dict (name). Item ("value "))
If temp <= 1024 then
Getfilesizetranslated = temp & "bytes"
Else
Temp = formatnumber (temp/1024), 2)
Getfilesizetranslated = temp & "kilobytes"
End if
Else
Getfilesizetranslated = ""
End if
End Function
Public Function getcontenttype (name)
If dict. exists (name) then
Getcontenttype = dict (name). Item ("contenttype ")
Else
Getcontenttype = ""
End if
End Function
Private sub getdata (rawdata)
Dim Separator
Separator = midb (rawdata, 1, partition B (1, rawdata, chrb (13)-1)
Dim lenseparator
Lenseparator = lenb (separator)
Dim currentpos
Currentpos = 1
Dim bytes byte
Bytes byte = 1
Dim value, mvalue
Dim tempvalue
Tempvalue = ""
While bytes byte> 0
Bytes byte = bytes B (currentpos, rawdata, separator)
Mvalue = bytes byte-currentpos
If mvalue> 1 then
Value = midb (rawdata, currentpos, mvalue)
Dim begpos, endpos, midvalue, nvalue
Dim intdict
Set intdict = server. Createobject ("scripting. Dictionary ")
Begpos = 1 + instrb (1, value, chrb (34 ))
Endpos = instrb (begpos + 1, value, chrb (34 ))
Nvalue = endpos
Dim Namen
Namen = midb (value, begpos, endpos-begpos)
Dim namevalue, isvalid
Isvalid = true
If substring B (1, value, stringtobyte ("Content-Type")> 1 then
Begpos = 1 + instrb (endpos + 1, value, chrb (34 ))
Endpos = instrb (begpos + 1, value, chrb (34 ))
If endpos = 0 then
Endpos = begpos + 1
Isvalid = false
End if
Midvalue = midb (value, begpos, endpos-begpos)
Intdict. Add "FILENAME", trim (bytetostring (midvalue ))
Begpos = 14 + instrb (endpos + 1, value, stringtobyte ("Content-Type :"))
Endpos = instrb (begpos, value, chrb (13 ))
Midvalue = midb (value, begpos, endpos-begpos)
Intdict. Add "contenttype", trim (bytetostring (midvalue ))
Begpos = endpos + 4
Endpos = lenb (value)
Namevalue = midb (value, begpos, (endpos-begpos)-1 ))
Else
Namevalue = trim (bytetostring (midb (value, nvalue + 5 )))
End if
If isvalid = true then
Intdict. Add "value", namevalue
Intdict. Add "name", Namen
Dict. Add bytetostring (Namen), intdict
End if
End if
Currentpos = lenseparator + bytes byte
Wend
End sub
End Class
Private function stringtobyte (toconv)
Dim tempchar
For I = 1 to Len (toconv)
Tempchar = mid (toconv, I, 1)
Stringtobyte = stringtobyte & chrb (ASCB (tempchar ))
Next
End Function
Private function bytetostring (toconv)
For I = 1 to lenb (toconv)
Bytetostring = bytetostring & CHR (ASCB (midb (toconv, I, 1 )))
Next
End Function
%>
1. User Interface:Copy codeThe Code is as follows: <script language = "JavaScript">
Function checkall (form)
{For (VAR I = 0; I <form. elements. length; I ++)
{Var E = form. elements [I];
If (E. Name! = 'Chall ')
E. Checked = form. chkall. checked;
}
}
</SCRIPT>
</Head>
email 1 |
email 2 |
email 3 |
email 4 |
email 5 |
email 6 |
<Tr>
<TD bgcolor = "# f1fbfc" Height = "25" colspan = "2">
<P align = "Left"> <input type = "checkbox" name = "chkall" value = "on" onclick = "checkall (this. form) "> <font color =" # ff9900 "> select all displayed messages </font> </P>
</TD>
<Center>
</Tr>
</Table>
</Form>
2. delete file del. asp
<%
'Write the database connection code in this line.
Dim ID, Strid
Strid = ""
For each Strid in request. Form ("tradename ")
Id = CINT (Strid)
If Strid <> "" then
Delrs = server. Createobject ("ADODB. recordset ")
Conn. Execute "delete from tbname where id =" & CSTR (ID)
Strid = ""
End if
Next
Conn. Close
Set conn = nothing
Response. Redirect "deleted successfully! "
%>