|
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>
|