I want to make an input form from which the Admin can:
Browse his PC.
Locate a file.
Send it to a database.
This file can be a photo.
The photo to be displayed via another form.Just a simple upload form. <!-- m --><a class="postlink" href="http://quasi-ke.servebeer.com/sampleaps/upload.aspx">http://quasi-ke.servebeer.com/sampleaps/upload.aspx</a><!-- m --> (I have this disabled so people can't upload to my server)
Here is the code I used.
<%@ Page Language="VB" Debug="true"%>
<script runat="server">
Sub uploadit (Sender as Object, e as EventArgs)
Dim strFileName as string
strFileName = theFile.PostedFile.FileName
Dim theFileName as string = System.IO.Path.GetFileName(strFileName)
Try
theFile.PostedFile.SaveAs("c:\Inetpub\wwwRoot\sampleaps\" + theFileName) 'Be sure to change this path for your dir!
successful.visible= true
catch Exp as exception
woops.Visible = true
End Try
End Sub
</Script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
Simple Upload form
</title>
</head>
<body>
<form method="Post" enctype="Multipart/Form-Data" runat="Server">
Select a file to upload:
<input id="theFile" type="File" runat="Server" size="30">
<br><br>
<input type="Submit" value="Upload" onserverclick="uploadit" runat="Server">
<asp:label id="successful" runat="server" visible="false">
Your upload was a sucesses!
</asp:label>
<aspanel id="woops" runat="server" Visible="False">
Your File upload failed.
</aspanel>
</form>
</body>
</html>
Browse his PC.
Locate a file.
Send it to a database.
This file can be a photo.
The photo to be displayed via another form.Just a simple upload form. <!-- m --><a class="postlink" href="http://quasi-ke.servebeer.com/sampleaps/upload.aspx">http://quasi-ke.servebeer.com/sampleaps/upload.aspx</a><!-- m --> (I have this disabled so people can't upload to my server)
Here is the code I used.
<%@ Page Language="VB" Debug="true"%>
<script runat="server">
Sub uploadit (Sender as Object, e as EventArgs)
Dim strFileName as string
strFileName = theFile.PostedFile.FileName
Dim theFileName as string = System.IO.Path.GetFileName(strFileName)
Try
theFile.PostedFile.SaveAs("c:\Inetpub\wwwRoot\sampleaps\" + theFileName) 'Be sure to change this path for your dir!
successful.visible= true
catch Exp as exception
woops.Visible = true
End Try
End Sub
</Script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
Simple Upload form
</title>
</head>
<body>
<form method="Post" enctype="Multipart/Form-Data" runat="Server">
Select a file to upload:
<input id="theFile" type="File" runat="Server" size="30">
<br><br>
<input type="Submit" value="Upload" onserverclick="uploadit" runat="Server">
<asp:label id="successful" runat="server" visible="false">
Your upload was a sucesses!
</asp:label>
<aspanel id="woops" runat="server" Visible="False">
Your File upload failed.
</aspanel>
</form>
</body>
</html>