DotNetted - Windows hosting specialists
- Windows Hosting Specialists -
Windows 2003 hosting  
 
General Support
Domain Names
Default Documents
SSL Shared Cert
ASP 500 error message
Pre-installed Files
Enabling ASP.NET 1.1
Publishing Your Site
Uploading with FTP
FrontPage/Visual Studio
Using DreamWeaver
E-Mail
Greylisting (important)
Setup pop3 and smtp
Using webmail
E-mail administration
Configure spam filters
Databases
Access Database
SQL Server 2005
SQL Server 2000
Scripting
ASP Mail Script
ASP Form To E-Mail
ASP Send Secure E-Mail
Other ASP Components
Session State for .NET
Send mail with .NET 1.1
Send mail with .NET 2.0
Upload file using .NET
Contact tech support

Upload file using .NET

With Classic ASP it was difficult to upload files to your account via a web page without the use of a third party component. This has changed with the introduction of .NET and it's now possible to easily upload files with just a few lines of code.

The following script is a generic upload script that uses an html form which allows you to select a file on your local machine and then upload it to the server - the file will be uploaded to the some folder on the server from which the upload script was run.

Just copy and paste the code into a file and save it to your account with an .aspx suffix.

<html>
<script language="VB" runat="server">
Sub File_Upload (Sender as Object, e as EventArgs)
Dim strFileName as string
strFileName = MyFile.PostedFile.FileName
Dim myFileName as string = System.IO.Path.GetFileName(strFileName)
Try
MyFile.PostedFile.SaveAs(Server.mappath("/") + myFileName)
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
ThankYouMessage.Visible = true
catch Exp as exception
ErrorMessage.Visible = true
End Try
End Sub
</Script>

<body>
<form method="Post" enctype="Multipart/Form-Data" runat="Server">
Choose a file to upload to the server:<br>
<input id="MyFile" type="File" runat="Server" size="25">
<p></p>
<input type="Submit" value="Upload" onserverclick="File_Upload" runat="Server"><P>
<asp:panel id="ThankYouMessage" runat="server" Visible="False">
Your File was sucessfull.<p>
File Name: <span id="FileName" runat="Server"/><br>
File Content: <span id="FileContent" runat="Server"/><br>
File Size: <span id="FileSize" runat="Server"/>bytes<br>
</asp:panel>
<asp:panel id="ErrorMessage" runat="server" Visible="False">
Your File was not sucessfull.
</asp:panel>
</form>
</body>
</html>

Reliability And Security -
Separate application for each site
Unique 'sandboxed' user per site
Windows 2003 / IIS 6 web hosting
Virus/Spam Protection -
All incoming e-mail virus checked
Fully configurable spam filtering
MS Scripting Support -
Full support for .NET version 1.1
Full support for .NET version 2.0
ASP.NET 3.0 and 3.5 extensions
Full support for ASP 'Classic' 3.0
Quality ASP components installed
Generous Allowances -
100 MB web space as standard
4 GB data transfer as standard
Complete E-mail Service -
pop3 and smtp e-mail services
Industry leading webmail interface
Web based administration interface
Development Software -
Compatible with Dreamweaver MX
Compatible with Visual Studio .NET
Compatible with MS Frontpage
Database Support -
MS Access databases supported
SQL Server 2000 database £6 mth
SQL Server 2005 database £6 mth
Statistics Reporting -
Comprehensive web based stats
Pre-defined or custom stats reports
Optional SSL support -
Shared SSL access just £1 / month
Your own SSL cert just £5 / month