How to Use Dundas Upload?

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

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:

Line No Coding
1 <%
2 Set objUpload = Server.CreateObject ("Dundas.Upload.2")
3 objUpload.Save "c:\temp\"
4 For Each objUploadedFile in objUpload.Files
Response.Write "<br>The " & objUploadedFile.TagName & " file input box was used to upload a file."
Next
5 For Each objFormItem In objUpload.Form
Response.Write "<br>The name of the form item is: " & objFormItem
Response.Write "<br>The value of the form item is: " & objFormItem.Value & "<br>"
Next
6 Set objUpload = Nothing
7 %>

Line No Explanation
1 Open ASP tag
2 Create instance of Upload control
3 Save uploaded files to to disk specified by physical path
4 Retrieve the value of a form element called txtName
5 Retrieve the size of the first uploaded file
6 Release resources
7 Close ASP tag

Sample Coding:

Add Feedback