ASP.NET form to upload files to your Windows 2008 site
Here is a sample asp.net upload script that will work on our Windows 2008 servers. You can copy it into a text file and rename it upload.aspx then upload it to your site space. It is currently set to upload a given file to a folder called "uploads" so you'll need to create that folder and give it write permissions (this can be done through your onCloud control panel).
You will need to copy and paste the script below into your favorite text editor and save it as upload.aspx (or any name of your choosing with and .aspx extension). You can then upload the script anywhere within your /wwwroot folder. You also need to create a folder in your /wwwroot folder called uploads.
<%@ Import namespace="System.IO"%>
<title>Uploading a File</title>
<script language="VB" runat="server">
Sub Upload_Click(source As Object, e As EventArgs)
If Not (uploadedFile.PostedFile Is Nothing) Then
Dim postedFile = uploadedFile.PostedFile
Dim filename As String = Path.GetFileName(postedFile.FileName)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength
postedFile.SaveAs(Server.MapPath("~") & "uploads\" & filename)
message.Text = postedFile.Filename & " uploaded" & _
"<br>content type: " & contentType & _
"<br>content length: " & contentLength.ToString()
Catch exc As Exception
message.Text = "Failed uploading file"
<form enctype="multipart/form-data" runat="server">
Select File to Upload:
<input id="uploadedFile" type="file" runat="server">
<input type=button id="upload"
<asp:Label id="message" runat="server"/>