TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
wassim safa
NA
4
2.2k
load image from sql server using mvc 5
Feb 18 2016 3:04 AM
hi,plz i need help for loading image saved at sql server from MVC 5.
i used to call $.ajax({ url: './cName '/OpenDocument/?id=' + dataRecord.DocumentID_PK, data: '', type: 'POST' });
and at controller:
public byte[] GetImageFromDataBase(int Id)
{
var q = from temp in db.VwDocuments where temp.DocumentID_PK == Id select temp.DocumentContent;
byte[] cover = q.First();
return cover;
}
public FileResult OpenDocument(int id)
{
try
{
byte[] cover = GetImageFromDataBase(id);
if (cover != null)
{
//return File(cover, "image/jpg");
return File(cover,"application/octetstream", "elementary19240001");
}
else
{
return null;
}
Reply
Answers (
3
)
How to compare Two openoffice documents(.odt)
how to create language translator in asp.net c#?