|
Answer
by: Stuart Pierce, Aplus.Net Knowledge
Base Support.
The Aplus.Net Windows-based hosting plans (Business Class Windows, Pro Windows and eCommerce Windows)
support the Persits ASPUpload Component. This is one of the best and
most popular ASP upload components. The Persits ASPUpload is a COM+
component which enables an ASP application to
capture, save and process files uploaded to your web server with a
browser. This KB article sets up a simple example of its use. Please
consult the official webpage of this component at http://aspupload.com/index.html
for more features. The User Manual is located at http://aspupload.com/manual.html.
The basic steps for uploading files using the ASPUpload Component with
your Windows-based hosting plan are listed below:
- creating an HTML form file (in our example: form.html)
- creating an ASP script file (in our example: UploadScript.asp)
- uploading these two files to your WWWROOT web
directory (or any of its subdirectories). The example below assumes
that both files reside in the same web directory.
- setting writable
permissions on the Destination Directory (the directory where files
will be uploaded). The Destination Directory is specified in the
UploadScript.asp file.
I. CREATING THE form.html
FILE
Here is a complete working example of a form file allowing the upload
of up to three files:
<HTML>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="UploadScript.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>
At your form.html page, the form will look like this:
II. CREATING THE UploadScript.asp
FILE
Here is a complete working example of a script file which will upload
to a Destination Directory aspupload
which is a subdirectory of the main WWWROOT:
<HTML>
<BODY>
<%
Set
Upload = Server.CreateObject("Persits.Upload")
Count
= Upload.Save("D:\inetpub\virtual\yourFTPusername\wwwroot\aspupload")
Response.Write
Count & " file(s) uploaded to D:\inetpub\virtual\yourFTPusername\wwwroot\aspupload"
%>
</BODY>
</HTML>
In the example above you only have to replace yourFTPusername with
your actual FTP username. Of course, you can also change the
Destination Directory to any other already
existing web directory.
III. UPLOADING form.html
and UploadScript.asp
TO YOUR FTP SPACE
You can use the File Manager tool for this matter:
IV. SETTING WRITABLE PERMISSIONS ON THE DESTINATION DIRECTORY
In our example, the Destination Directory is aspupload. Here is
how you can set writable permissions using the File Manager tool
available in the Control Panel:
|