This example shows how to upload an image file to a file server and save it in a web friendly format. There are two parts to this - an HTML form which contains an file input box and an Active Server Page to decode the uploaded file and save it as something web friendly.
HTML for the form

The HTML for your form should appear something like the following. Note that we are using a multipart encoding, something which is required if you are using the input file-type form element.

[HTML] <form method="post" action="upload.aspx" name="submit" enctype="multipart/form-data">
Choose a file to upload:<br>
<input type="file" name="filefield" size="40"> <br>
<input type="submit" name="submit" value="submit"> lt;br>

Decoding the Data

Your upload.aspx page should contain code to decode the uploaded file and save it out in a web friendly format. First we find the physical path to the place we are going to save the file.

[C#] string path = Server.MapPath("../images/picture.jpg");

[Visual Basic] Dim path As String
path = Server.MapPath("../images/picture.jpg")

Next we get the uploaded information out of the request. Here we use the standard .NET upload classes but for more control over the upload process you can use ABCUpload.

[C#] HttpPostedFile field = Request.Files("filefield");

[Visual Basic] Dim field As HttpPostedFile
field = Request.Files("filefield")

Drawing the Data

Finally we create a Canvas, draw the binary data onto it and save the result out in the location we identified earlier.

[C#] Canvas canvas = new Canvas();
canvas.DrawImage(XImage.FromStream(field.FileName, field.InputStream), new DrawOptions());

[Visual Basic] Dim canvas As New Canvas
Dim drawOpts As New DrawOptions
canvas.DrawImage(XImage.FromStream(field.FileName, field.InputStream), drawOpts)