Click here to Skip to main content
15,889,810 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to write out a image from the database but i only get the url for the image , and the image is not displayed

C#
            if (DropDownListDownloadCv0.Text == "DOC")
            {

                string sDirPath = Server.MapPath("~/PDF_WORD/Docs");

                var ObjSearchDir = new DirectoryInfo(sDirPath);
                if (!ObjSearchDir.Exists)
                {
                    ObjSearchDir.Create();
                }
                string strFileName =
                    HttpContext.Current.Server.MapPath("~/PDF_WORD/Docs/Cv." + "DOC" +
                                                       "");

                var file = new FileStream(strFileName, FileMode.OpenOrCreate, FileAccess.Write);

                var sw = new StreamWriter(file);

                sw.Write(Loggo.ImageUrl = theEmpl.logo);
                sw.Write(LabelFirstName.Text);
                sw.Write(LabelLastName.Text);
                sw.Close();
                file.Close();

            }
    }
    }
}
Posted
Comments
Marco Bertschi 24-Apr-13 6:15am    
Can you try to exclude
sw.Write(LabelFirstName.Text);
sw.Write(LabelLastName.Text);
Kurac1 24-Apr-13 6:20am    
i get the same problem only get http://wingtipserver/Lists/Cv.Knowit-ListInstance3/attachments/1/knowit_Loggo.png and not the image
[no name] 24-Apr-13 7:05am    
Maybe you should show the code that you have for inserting the image in the database and the code that you are using to get the image from the database.

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