Search the Knowledgebase Browse by Category
      Home       Web Hosting       Web Hosting Guide       Sample Scripts (Windows)
   File upload using Asp and Asp.Net

There are 2 types of upload components on the Windows server.

1. ASP Smart-upload component.

2. Persists AspUpload component.

The file upload form should submit the upload file to the upload script which will upload this file in the upload-path mentioned.

The sample upload script for above 2 upload components is as follows :

1. ASP Smart-upload component :

<%

' 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("/aspSmartUpload/Upload")

' sample with a physical path
' intCount = mySmartUpload.Save("c:\temp\")

' Display the number of files uploaded
Response.Write(intCount & " file(s) uploaded.")
%>

2. Persists AspUpload component :

a. ASP sample :

<%
Set Upload = Server.CreateObject("Persits.Upload")
Count = Upload.Save("c:\upload")         ' sample with a physical path

Response.Write Count & " file(s) uploaded to c:\upload"

%>

b. Asp.Net Sample :

<%@ Page aspCompat="True" %>

<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="ASPUPLOADLib" %>

<script runat="server" LANGUAGE="C#">

void Page_Load(Object Source, EventArgs E)
{
ASPUPLOADLib.IUploadManager objUpload;
objUpload = new ASPUPLOADLib.UploadManager();

int Count = objUpload.Save("c:\\upload", Missing.Value, Missing.Value);

txtResult.InnerHtml = "Success. " + Count + " file(s) uploaded to c:\\upload.";
}

</script>


Live Support

If you have any questions at all, please don't hesitate to contact us

+91.22.28663101, 66789456

To submit Support ticket, click here


     Related FAQs
Setting up feedback form using ASP
Using AspEmail in ASP and ASP.Net
Using CDO (Collaboration Data Objects)
Connecting to MsSQL using DSN (Windows)
Connecting to MsSQL using DSN-less connection (Windows only)
File upload using Asp and Asp.Net
MsSQL Server Connection Strings - ODBC, OLE DB