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

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:

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">
<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: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!">
<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"
<asp:Label id="NotificationLabel" runat="server" Visible="False">

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
Go see this article:;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-2019  |  Page Processed at 2019-06-20 1:58:01 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search