AspUpload is a COM+ component which enables an ASP application to capture, save and process files uploaded to the web server with a browser. The files are selected for uploading via an HTML POST form using the <INPUT TYPE=FILE> tag.
With AspUpload, you can add file upload functionality to your Web application in as little as 2 lines of ASP script. In addition to uploading, AspUpload offers a wide range of file management functions, including secure downloading, saving files in the database, permission and attribute management, image size extraction, file encryption, etc.
The following HTML form (located in the sample file
Form1.asp) enables a user to select up to three files for uploading to the server:
<HTML> |
<BODY BGCOLOR="#FFFFFF"> |
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="UploadScript1.asp"> |
<INPUT TYPE="FILE" SIZE="40" NAME="FILE1"><BR> |
<INPUT TYPE="FILE" SIZE="40" NAME="FILE2"><BR> |
<INPUT TYPE="FILE" SIZE="40" NAME="FILE3"><BR> |
<INPUT TYPE=SUBMIT VALUE="Upload!"> |
</FORM> |
</BODY> |
</HTML> |
|
Notice the ENCTYPE="multipart/form-data" attribute in the <FORM> tag. It instructs the browser to send the entire file to the server and not just the file name entered in the input text box. It is absolutely mandatory that your upload forms contain this attribute, or no uploading can be performed.
This form contains three items <INPUT TYPE="FILE"> which appear on the page as text boxes with the Browse button next to them. Each box can be used to select one file only. While the SIZE attribute of an <INPUT TYPE="FILE"> item is optional, the NAME attribute is required.
This form invokes the upload script UploadScript1.asp shown below:
<HTML> |
<BODY> |
<% |
Set Upload = Server.CreateObject("Persits.Upload") |
Count = Upload.Save("c:\upload") |
Response.Write Count & " file(s) uploaded to c:\upload" |
%> |
</BODY> |
</HTML> |
|
|