QuickStart (Dundas Upload Control 2.0)

Dundas

QuickStart (Dundas Upload Control 2.0)

Overview | Properties | Methods


The following code demonstrates how to populate the Upload control's collections, save uploaded files to disk and retrieve form data. Please note that for brevity we do not perform any error checking (done with VBScript's Err object and raised exceptions).

We will assume that a form with an encoding type of "Multipart/Form-Data" is POSTING to the ASP page which contains the following code:

<%@ Language=VBScript %>
<%
'most control methods throw an exception if an error occurs so we will use an

' On Error Resume Next statement

On Error Resume Next

'create instance of Upload control
Set
objUpload = Server.CreateObject("Dundas.Upload.2")

'save uploaded files to to disk. Note that we could also save the
' uploaded files to memory. This populates the Form and Files collections

objUpload.Save "c:\temp\"

'retrieve the value of a form element called txtName
strName = objUpload.Form("txtName")

'retrieve the size of the first uploaded file
strSize = objUpload.Files(0).Size

'release resources
Set
objUpload = Nothing
%>