Edited by XIII
Hello. I'm new to ASP.Net and am learning asp.net 1.1 with vb. I bought a book and made a working .aspx page that will upload to my own computer's hard drive. Since I'm trying to learn this for websites that will be published on shared hosting I need help to alter the code so that it'll upload to a folder on my website rather than my own C:\ drive.
Fpr example if my website name/folder is "WEBSITE" and the folder I want to upload the images is "imagesup"
Here's the code I'm using:
<%@ Import Namespace="System.IO" %>
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<script language="VB" runat="server">
Sub Upload(s As Object, e As EventArgs)
If Not (txtUpload.PostedFile Is Nothing) Then
Dim postedFile = txtUpload.PostedFile
Dim filename As String = Path.GetFileName(postedFile.FileName)
postedFile.SaveAs("c:\" & filename)
lblMessage.Text = "File has been uploaded"
End If
End Sub
</script>
<form enctype="multipart/form-data" runat="server">
<p><input id="txtUpload" type="file" runat="server" />
</p>
<p><input id="btnUpload" type="button" value="Upload" OnServerClick="Upload" runat="server" />
</p> <p><asp:Label id="lblMessage" runat="server" /></p>