Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  SA: File Upload, Limit Size
     [next Lesson]  Upload/Soft-Artisans Listserver

Uploading with SA-FileUp -- Uploading Multiple Files

The Form Definition

To upload multiple files, include multiple <INPUT> tags of TYPE=FILE.

   filename=/sa/test/multifile.asp

<Test Script Below>


<html>
<head>
<title>Please upload two files</title>
</head>
<body>
    <form enctype=multipart/form-data action=multifilerespond.asp method=post>
    <table>
    <tr>
    <td>Enter first file:</td>
    <td><input type=file name=f1></td>
    </tr>
    <tr>
    <td>Enter second file:</td>
    <td><input type=file name=f2></td>
    </tr>
    <tr>
    <td></td>
    <td align=right><input type=submit value="Submit"></td>
    </tr>
    </table>
    </form>
</body>
</html>

While multiple inputs work well for a small number of files, uploading through a form that includes more than a few file inputs is time-consuming. If you want to allow your users to upload numerous files, consider using a client-side tool, like SA-JFile or SA-XFile.

The Server-side Processing

When processing the upload of multiple files, refer to each by name, as follows.

   filename=/sa/test/multifilerespond.asp

<Test Script Below>


<html>
<head>
<title>Multiple File Upload Results</title>
</head>
<body>
    Thank you for uploading your files.<br>
    <% Set upl = Server.CreateObject(SoftArtisans.FileUp) %>
    <% upl.Form(f1).SaveAs C:\temp\upload1.out %>
    Total Bytes Written for File 1: <%=upl.Form(f1).TotalBytes%><br>
    <% upl.Form(f2).SaveAs C:\temp\upload2.out %>
    Total Bytes Written for File 2: <%=upl.Form(f2).TotalBytes%><br>
</body>
</html>

Chaz Wish List
Tall Tip $5
Grande Tip $20
Venti Tip $39
Tip Jar Thanks
2004 Thanks
2005 Thanks
HUGE Tip -love site