Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8242859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:18:36+00:00 2026-06-07T21:18:36+00:00

I would like to upload an image from an asp.NET Web Forms (4.0) application

  • 0

I would like to upload an image from an asp.NET Web Forms (4.0) application to an Oracle 11g database. Eventually, I would also need to retrieve the image.

I was told to use a blob type, but this can change if a better solution is found.

From the front end perspective I am using the asp.NET File Upload component and is great to select the path of the file.

What is the best way around it? Work with blob’s? work with bfile’s? upload the image on the server and just store the path?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:18:39+00:00Added an answer on June 7, 2026 at 9:18 pm

    Assuming you have a table called IMAGES with a BLOB column, you’ll want to do something similar to:

    byte[] imageData = FileUpload1.FileBytes;
    
    OracleCommand cmd = new OracleCommand("INSERT INTO IMAGES(PARENT_ID, IMAGE_DATA) VALUES(:1, :2)", connection);
    cmd.Parameters.Add("1", OracleDbType.Int32, parentID, ParameterDirection.Input);
    cmd.Parameters.Add("2", OracleDbType.Blob, imageData, ParameterDirection.Input);
    
    cmd.ExecuteNonQuery();
    

    Update:
    When it comes to display the image, you mainly need to understand that the HTML page only contains a reference to the image (<img src="ImageFromDatabase.ashx?id=1234">) and that the image itself is served by a separate request. The following example uses a Generic Handler:

    public void ProcessRequest (HttpContext context) {
        HttpRequest request = context.Request;
        int parentID = Int32.Parse(request.QueryString["id"]);
    
        OracleCommand cmd = new OracleCommand("SELECT * FROM IMAGES WHERE PARENT_ID = :1", connection);
        cmd.Parameters.Add("1", OracleDbType.Int32, parentID, ParameterDirection.Input);
        OracleDataReader reader = cmd.ExecuteReader();
    
        byte[] imageData = ((OracleBlob)reader["IMAGE_DATA"]).Value;
        context.Response.ContentType = "image/jpeg";
        context.Response.BinaryWrite(imageByte);
    } 
    

    I’ve omitted all the error handling which you should be added in a real application.

    Update 2:

    If you have a grid view, you could define the image column like this:

    <asp:Image ID="Image1" runat="server" ImageUrl='<%# "ImageFromDatabase.ashx?id=" + Eval("ImageID")%>'/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have created a web application, using ASP.NET, that allows users to upload documents
I am doing an image upload handler and I would like it to detect
I have an upload that stores images to a SQL 2008 from an ASP.NET
I'm working on a stock-standard, ASP.NET MVC 3 web application (hosted on IIS 7).
It would be great if I could upload an image from my hard drive
When I upload images in Wordpress I get: http://test.net/wp-content/uploads/2011/04/test_image.jpg however I would like it
I would like to upload files just like google mail does. I would want
I would like to upload a picture to Facebook event. I don't understand the
Hey. I would like to upload a file and then parse it. Because parsing
I've just finished a functional piece of code and would like to upload it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.