Why full imagepath isnot save in database

Posted by t5j9033387989 under ASP.NET on 12/13/2013 | Points: 10 | Views : 905 | Status : [Member] | Replies : 4
Hey i use linq to sql for store and retrive image from database ,i use varchar(max) datatype for it.
Here is my code for save image,

 EventBL r = new EventBL();
r.Banner_SignUp_Page = System.IO.Path.GetFullPath(fuBanner.FileName);
r.Insert();


and here is for retrive it.
var result1 = from a in db.EMR_INVITATIONs
join b in db.EMR_EVENTs on a.EventID equals b.EventID
where b.EventID == (int)Session["eventid"]


select new
{
Banner = b.Banner_SignUp_Page,
};

var ev = result1.First();

Image1.ImageUrl = ev.Banner;


but in database i found that whole path of image isn't store .
in database some of the path is stored,and i can't retrive image from database
If there is solution or improvement in my code
Then please let me know,
Thanks in advance.

mark this answer if it will really help you,

Thanks&Regards
ketan



Responses

Posted by: Nismeh on: 12/13/2013 [Member] Starter | Points: 25

Up
0
Down
As per new constraints of HTML5 browser can't get any details of system. So even it hides path. If you select file from there it will show like

c:\fakepath\text.txt



IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

t5j9033387989, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: t5j9033387989 on: 12/13/2013 [Member] Starter | Points: 25

Up
0
Down
No,this not happen yar,
is it true then why i can't retrive image from database.


mark this answer if it will really help you,

Thanks&Regards
ketan

t5j9033387989, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sheonarayan on: 12/13/2013 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Ketan,

Thanks, I think your title of the question is confusing as perhaps in this case you are not storing the image into the database but only the path or name of the image into the database and to show the image you are retrieving image file name from the database and setting the ImageUrl property of the asp:Image control.

I would suggest you to ViewSource your .aspx page in the browser and see if your image path is set properly for the <img> element, if not tweak the code to set the correct url.




Regards,
Sheo Narayan
http://www.dotnetfunda.com

t5j9033387989, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: t5j9033387989 on: 12/16/2013 [Member] Starter | Points: 25

Up
0
Down
Thanks sir,
for reply

i use varchar(max) datatype for save image path.
now i get correct imageurl but i can't show it

i got this type image url in database
D:\EventmanagerCode\December\12dec\EventManagerApp\EventManagerApp\evenementen\Images\11.jpg

but when i debug it i got this type of url
"D:\\EventmanagerCode\\December\\12dec\\EventManagerApp\\EventManagerApp\\evenementen\\Images\\11.jpg"

can you give me reson and solution for that

Thanks is advance

mark this answer if it will really help you,

Thanks&Regards
ketan

t5j9033387989, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response