Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i save my image in temp folder of application directory
i retrieve that and want to show that on image control of asp.net

but image not shown

here below is code
plz help

C#
String fileName = FileUpload1.FileName;

           int newlrmnsdf = fileName.Length;
           int gdf = newlrmnsdf - 4;
           string strwithoutEXT = fileName.Substring(0,gdf);
           string currenttime = System.DateTime.Now.Minute.ToString() + "_";
           string newFileName = strwithoutEXT + currenttime + ".jpg";
           string actualFilename = currenttime + newFileName;
           bool IsExists = System.IO.Directory.Exists(Server.MapPath("temp"));
           if (!IsExists)
           {
               System.IO.Directory.CreateDirectory(Server.MapPath("temp"));
                FileUpload1.SaveAs(Server.MapPath("~/temp/") + actualFilename);
           }
           else
           {
                FileUpload1.SaveAs(Server.MapPath("~/temp/") + actualFilename);


           }
           if (fileName.Contains(".pdf"))
           {
               //Image1.Visible = false;
             //  frame1.Attributes.Add("src", "http://localhost:50389/temp/" + actualFilename);
           }
           else
           {
              // frame1.Visible = false;
               //  string url = "http://localhost:50389/temp/" + actualFilename;
               string path = Server.MapPath("~/temp/");
               Image1.ImageUrl = path + actualFilename;
           }
Posted

1 solution

problem solved no need to take image control

rather use iFrame in which assign the iframe source i.e

iframe1.src=
"~/temp/"+actualFilename
 
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