How do I add impersonation for ASPUpload


We provide an ASP component installed on all the web servers that allows uploading files using classic asp. This component is called Persits AspUpload. If you want to upload files without giving public write, you can impersonate with your ftp account. The following below is an example that will display 3 fields to browse and select files to upload using your ftp account. This is more secure as public now does not have write access to your specific folder where your files will be uploaded at.

Create a file called uploads.asp and save the following text below in it.

<HTML>

<BODY BGCOLOR="#FFFFFF">

<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="/knowledge_center/UploadScript1.asp">
<INPUT TYPE=FILE SIZE=60 NAME="FILE1"><BR>

<INPUT TYPE=FILE SIZE=60 NAME="FILE2"><BR>
<INPUT TYPE=FILE SIZE=60 NAME="FILE3"><BR>
<INPUT TYPE=SUBMIT VALUE="Upload!"> </FORM>

</BODY>
</HTML>


Create another file called UploadScript1.asp and save the following text below in it.

  • Please note that domain is the data center your website is located at. It will either be DFW, or ORD.
<HTML>
<BODY>

<%

Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.LogonUser "domain", "ftpUserName", "ftpPassword"

Count = Upload.Save("\\location\where\I\want\my\files\uploaded\at")

%>
<% = Count %> files uploaded.

</BODY>
</HTML>

Now, just browse to your url www.mydomain.com/uploads.asp and you are ready to upload files.

Here's a working example of the above scripts, hosted on Cloud Sites.

For more information, please visit http://www.aspupload.com/ for more examples and the manual.



Was this content helpful?




© 2014 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER