This example shows how a basic upload works. It assumes that minimal configuration settings in the web.config file are implemented.

 

   
HTML
 
basicupload.htm    
     

To start with you need an HTML form with a file field in it. Note that only multipart forms support file upload - hence enctype="multipart/form-data". If you try to upload a file from a form that isn't multipart encoded you will not receive any files.

This page submits data to basicupload.aspx.

<html>
<body>
<form method="post" action="basicupload.aspx" enctype="multipart/form-data">
<input type="file" name="filefield"><br>
<input type="submit" name="submit" value="submit">
</form>
<body>
</html>


   
ASP
 
basicupload.aspx    
     

Our ASPX Page simply creates an Upload object and saves the uploaded file out into the 'write' directory as 'myupload.dat'.

ABCUpload automatically detects that the location you're specifying is a URL and automatically resolves it into a file path. However you can equally well use an absolute file path if you prefer.

[C#]
<%@ Import Namespace="WebSupergoo.ABCUpload6" %>

<%
Upload theUpload = new Upload();
theUpload.Files["filefield"].SaveAs("write/myupload.dat");
%>

<html>
<body>
File uploaded...
</body>

[VB]
<%@ Import Namespace="WebSupergoo.ABCUpload6" %>

<%
Dim theUpload As Upload = New Upload()
theUpload.Files("filefield").SaveAs("write/myupload.dat")
%>

<html>
<body>
File uploaded...
</body>