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 6219721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:50:02+00:00 2026-05-24T07:50:02+00:00

This is a variation on a question that has been asked here several times.

  • 0

This is a variation on a question that has been asked here several times. One example: Display an image contained in a byte[] with ASP.Net MVC3. The question is how to render an image from a byte array.

In all those questions, there is an Action similar to one of the answers in the link I provided above:

public FileContentResult Display(string id) {   
byte[] byteArray = GetImageFromDB(id);   
return new FileContentResult(byteArray, "image/jpeg");
}

With an image tag similar to this:

<img src="@Url.Action("Display", new { id = Model.Id })" />

This is done because it’s not possible to send a byte array through a GET request, so just the id is sent allowing a lookup in the Action method. I get this part, it’s not the problem. What I’m trying to do is create a ‘Preview’ page, where they can check their work before saving in the database. They can see the layout of the Title, Text and Image and decide whether to save, or go back and Edit some more. Therefore, the ‘GetImageFromDB(id)’ part won’t work, since the object has not been saved yet to the database.

Is there any way to accomplish this, or do I just have to save the byte array temporarily in the database and access it that way for the Preview page?

  • 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-05-24T07:50:02+00:00Added an answer on May 24, 2026 at 7:50 am

    You need to store the uploaded file somewhere on the server if you want to show it later (as a preview or full size image). Whether it is the database or the file system it is up to you. So once the file is uploaded you could store it as a temporary file on some location on the server by renaming it using some unique Guid and return this Guid to the client so that it can create an action link to a preview controller action passing the Guid which will fetch the file from the temporary location and stream it to the client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, I know this question has been asked several times before and that in
I know that this type of question has been asked over and over again,
Apologies if this question has been asked before. I'm hoping that someone can step
I hope that this question has not been asked elsewhere, but I'm having difficulty
I know this question has been asked in several variations before, but my question
I'm sure some variation of this question has been asked before but all other,
I fully understand this question has been asked a lot , but I'm asking
This question has been brought up many times, but I'd like to ask it
You're probably thinking this has been asked a million times before but I think
I know that variations on this question have been asked, but I've tried all

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.