Knowledgebase: Windows Hosting > Plesk
How to use Dundas Upload ?
Posted by Senthil, Last modified by on 19 October 2007 03:56 PM
|
|
Dundas Upload is a server-side component that can be used to upload files from a client's machine to the server, under your domain. How do you use Dundas Upload? The following is an example of using the Upload component to upload a file: <% 'Create an instance of our Upload object. Set uploadObj = Server.CreateObject("Dundas.Upload.2") 'Disable unique names, to preserve the original filename. uploadObj.UseUniqueNames = False 'We need to catch any errors On Error Resume Next uploadObj.Save Server.MapPath(".") If (Err <> 0) Then Response.Write "An error occured: " & Err.Description End If %> The standard Request.Form collection becomes unusable when the Dundas.Upload.2 object is instantiated, to access the values of the Form collection, use something similar to this: <% formValue = uploadObj.Form("formField") 'Where formField is a field input that was posted. %> Posting a Form When you post a form to your script, if it contains a file field ( < input type="file" / > ) , you need to specify an encoding type. This can be done as follows: | |
|
Comments (0)