You can use the following code to upload files on our Windows 2000/2003 servers.
The html form allows the user to select the file(s).
Example HTML File (Form.html)
<HTML> <BODY BGCOLOR="white">
<H1>aspSmartUpload : Sample 1</H1> <HR>
<FORM METHOD="POST" ACTION="Sample1.asp
" ENCTYPE="multipart/form-data"> <INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR> <INPUT TYPE="FILE" NAME="FILE2" SIZE="50"><BR> <INPUT TYPE="FILE" NAME="FILE3" SIZE="50"><BR> <INPUT TYPE="FILE" NAME="FILE4" SIZE="50"><BR> <INPUT TYPE="SUBMIT" VALUE="Upload"> </FORM>
</BODY> </HTML>
|
The ASP
file uses aspSmartUpload to save the files to the server’s disk.
Example ASP
File (Sample1.asp
) - saves files to a folder named "Upload" in your "www" folder which you should create
|
<HTML> <BODY BGCOLOR="white">
<H1>aspSmartUpload : Sample 1</H1> <HR>
<% ' Variables ' ********* Dim mySmartUpload Dim intCount
' Object creation ' *************** Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload ' ****** mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server ' **************************************************************************** intCount = mySmartUpload.Save("/Upload")
' Display the number of files uploaded ' ************************************ Response.Write(intCount & " file(s) uploaded.") %> </BODY> </HTML>
|
In this sample, the files are saved directly with their original name to a virtual directory on the web server.