|
With ActiveFile you can upload files from any web browser or client that supports the RFC 1867 protocol. The topics that follow show how easy it is to add this capability to your Active Server Pages application. Upload Topics
|
|
Defining your
HTML form for file upload The user interface for uploading files from a web browser is defined as an HTML form. Whether you are modifying an existing HTML form or creating a new one from scratch, here are some easy steps to follow so that you can upload files from your form:
Here is a sample HTML form for uploading a file to the server:
|
|
Processing the
file upload on the server The action attribute of your HTML <FORM> tag must point to the Active Server Page that uses ActiveFile to process the data. This Active Server Page should follow these steps in order to process the uploaded data:
Here is a complete example that you can use with your Active Server Page:
In the above example, ActiveFile will upload the files into the C:\TEMP directory using the original client file names along with versioning to prevent any existing files from being overwritten. Also note that this example displays the client-side source file pathname stored in FormInput.Value. The target location of the file on the server can be found in FormInput.File.Name. For a more complete example, take a look at the ActiveFile Explorer sample application that demonstrates both file upload and download.
|
|
ActiveFile can handle uploading multiple files in a single request. However, a separate <INPUT TYPE="file"> form element must be added to your HTML form for each file that needs to be uploaded. For example, here is an HTML form for uploading two files to the server:
Note that the <INPUT TYPE="file"> elements have been given different names, UploadedFile1 and UploadedFile2. These names can then be used in the upload.asp script to index the Post.FormInputs collection and reference the files individually.
An alternative to using separate <INPUT TYPE="file"> form elements for uploading files is the AppletFile Upload Applet. This Java applet can be used in place of <INPUT TYPE="file"> form elements and is capable of uploading an arbitrary number of files. For more information, visit the AppletFile home page at http://www.infomentum.com/appletfile. |
|
Handling both
file and non-file form data In addition to uploading files, ActiveFile can also process non-file data from other types of form elements that are on the same HTML form. You can mix and match both <INPUT TYPE="file"> form elements and other types of form elements on your HTML form, and all of this data will be available in the Post.FormInputs collection after you call Post.Upload.
If you are modifying an existing application to use ActiveFile, you will need to change all references to form data to use the Post.FormInputs collection instead of Active Server Page's Request object.
|