Read and Write BLOB Data to a Database Table with ODP.NET
page 3 of 7
by Steven Swafford
Feedback
Average Rating: 
Views (Total / Last 10 Days): 56667/ 88

Create Your Web Form to Allow Uploading the Image and Relevant Data

[ Download Code ]

There are a total of eight controls which I am using in this example of which three are RequiredFieldValidators and one is a Label. I will not discuss these controls rather you may take time to read the following.

1. TextBox Control
2. Label Control
3. RequiredFieldValidator Control
4. HtmlInputFile Control

WebForm Screenshot:
WebForm

The one unique step you need to take for the HtmlInputFile Control is to import the System.Web.UI.HtmlControls Namespace. As well you will need to add the runat="server" attribute to this control.

Once you have created your web form you should have something similar to the one above. If you view the source of this form you should have something similiar to this.

<form id="Form1" method="post" encType="multipart/form-data" runat="server">
<P>Author:<BR>
<asp:TextBox id="AuthorTextBox" runat="server" MaxLength="50"></asp:TextBox><BR>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server"
 ControlToValidate="AuthorTextBox" ErrorMessage="Author name is required!">
 </asp:RequiredFieldValidator></P>
<P>Description:<BR>
<asp:TextBox id="DescriptionTextBox" runat="server" MaxLength="5000" Rows="10"
 TextMode="MultiLine" Columns="50"></asp:TextBox><BR>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server"
 ControlToValidate="DescriptionTextBox" ErrorMessage="Description is required!">
 </asp:RequiredFieldValidator></P>
<P><INPUT type="file" name="FileToUpload" id="FileToUpload" runat="server">
<asp:Button id="UploadButton" runat="server" Text="Upload"></asp:Button>
<asp:RequiredFieldValidator id="UploadValidator" runat="server" 
ErrorMessage="You must select an image to upload"
 ControlToValidate="FileToUpload"></asp:RequiredFieldValidator></P>
<P>
<asp:Label id="NotificationLabel" runat="server" Visible="False">
</asp:Label></P>
</form>

Now that you have you web form ready let us know take a look in the code behind.


View Entire Article

User Comments

Title: Read/Write BLOB data when file > 32K   
Name: Roger Rowe
Date: 2005-03-07 1:03:00 PM
Comment:
Go see this article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;322796
This shows you how to insert larger data - your version will die for data larger than 32K - a PLSQL limitation).






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 6:27:32 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search