I'm developing a MVC application and I need to show an image in the browser, but I haven't the file physically on disk.
I only have a byte[]
array in my model, with content of the image. Is there any "easy" trick to show the image in the view, without writing it to the disk?
The first approach that comes to my mind is writing a temp file, but:
- What file name should I choose?
- When should I delete it? I'm afraid that we will leak those files.
So I don't want to write the contents to a file. Is there any other approach?
Thanks in advanced.
EDIT: The result page is not only the image, I need to show some text, and below, the image, for example:
<%= Response.Write("Some text here") %>
<%= /* Here my image */ %>