Andrey Barykin
Andrey Barykin

Reputation: 21

JSON image upload to page

In my ASP.NET MVC4 project I use library jQuery. I define EF code first model.
Database has model like

public class Description{
  public int Id{}
  public string Name{}
  public byte[] Img{}
}

Pictures store in field "Img". And I cannot understand how to return this picture for representation while using AJAX query. Controller gives me JSONresult and I get JSON in representation. How I can get picture from it and insert it for example in div. Please give me advise. Thanks

Upvotes: 0

Views: 427

Answers (1)

scott-pascoe
scott-pascoe

Reputation: 1483

Based upon the answer to this question: how to load pictures from json array?

It appears that your javascript will need to iterate over the bytes and append them to the image data back over in the browser.

Upvotes: 1

Related Questions