Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
string fileID = Guid.NewGuid().ToString();
Byte[] imgBytes = p.ImgContent;
string filePath = Server.MapPath("~/Docs/" + fileID + p.ImgName);
FileStream fs = File.Create(filePath);
fs.Write(imgBytes, 0, imgBytes.Length);
fs.Flush();
fs.Close();

liContent.Text += "<a class='flipLightBox' href='" + filePath + "'>" + "<img class ='content' src=\"" + filePath + "\" />" + "&nbsp;" + "<span><b>" + p.Title + "</b>" + "<br>" + p.Description + "</span>" + "</a>";



[Edit member="Tadit"]
Added correct language to the pre tag.
[/Edit]
Posted
v2
Comments
Debug and see what is the value of filePath. Also check the Developer Console Window, if that is showing any issues.

1 solution

The reason the images do not show is because you are linking to them using the file system. Meaning, the path is something like, "C:\intepub\wwwroot\yourapp\docs\filename.jpg"

The path needs to be a url because it is the client's browser that will actually request it and needs access to it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900