Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while am uploding image it can showing in folder but i have to view from Database




C#
if (fileup.HasFile)
                    {
                        file = fileup.FileName;
                        bool ans = checkFileExtension(file);
                        if (ans)
                        {
                            try
                            {
                                fileadd = (Server.MapPath("Image\\") + txtMulShortName.Text + "." + file.Substring(file.LastIndexOf(".") + 1).ToString());
                                fileup.SaveAs(fileadd);
                            }
                            catch (Exception ex) { }
                            locLogo.ImageUrl = "~/Image/" + txtMulName.Text + "." + file.Substring(file.LastIndexOf(".") + 1).ToString();
                        }
                        else
                        {
                            msgmulliteral.Text = "Invalid file type of Logo, select only JPG files";
                        }

                    }
Posted

1 solution

Then you either need to change your software to store the image in a database, or to store the path to the image in the DB - it depends on your database and the field definition in it.

At the moment, you code just saves the image to a file on the server.
 
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